]> granicus.if.org Git - icinga2/commitdiff
Bugfix: Make sure Utility::Glob return false if no matching files were found.
authorGunnar Beutner <gunnar.beutner@netways.de>
Sun, 3 Feb 2013 00:30:19 +0000 (01:30 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Sun, 3 Feb 2013 00:30:19 +0000 (01:30 +0100)
lib/base/utility.cpp

index 195ac9ee9f72ca94d5f54395ac93543f1ff8b558..29ef5160fc4aa3f6e671b4e4e7ec3c64adb849bf 100644 (file)
@@ -483,6 +483,11 @@ bool Utility::Glob(const String& pathSpec, const function<void (const String&)>&
                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--) {