From: Gunnar Beutner Date: Sun, 3 Feb 2013 00:30:19 +0000 (+0100) Subject: Bugfix: Make sure Utility::Glob return false if no matching files were found. X-Git-Tag: v0.0.2~569 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=383d2369b13716a5fb39db43e9be50929886960c;p=icinga2 Bugfix: Make sure Utility::Glob return false if no matching files were found. --- diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp index 195ac9ee9..29ef5160f 100644 --- a/lib/base/utility.cpp +++ b/lib/base/utility.cpp @@ -483,6 +483,11 @@ bool Utility::Glob(const String& pathSpec, const function& throw_exception(PosixException("glob() failed", errno)); } + if (gr.gl_pathc == 0) { + globfree(&gr); + return false; + } + size_t left; char **gp; for (gp = gr.gl_pathv, left = gr.gl_pathc; left > 0; gp++, left--) {