[icinga-checkins] icinga.org: icinga2/master: Bugfix: Make sure Utility:: Glob return false if no matching files were found.

git at icinga.org git at icinga.org
Sun Feb 3 01:30:29 CET 2013


Module: icinga2
Branch: master
Commit: 383d2369b13716a5fb39db43e9be50929886960c
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=383d2369b13716a5fb39db43e9be50929886960c

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Sun Feb  3 01:30:19 2013 +0100

Bugfix: Make sure Utility::Glob return false if no matching files were found.

---

 lib/base/utility.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp
index 195ac9e..29ef516 100644
--- a/lib/base/utility.cpp
+++ b/lib/base/utility.cpp
@@ -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--) {





More information about the icinga-checkins mailing list