[icinga-checkins] icinga.org: icinga-core/r1.7: core: remove weird switch() statement when scanning checkresult queue #2950

git at icinga.org git at icinga.org
Sun Aug 19 19:44:44 CEST 2012


Module: icinga-core
Branch: r1.7
Commit: 2ee9cbef8a9e3c59263c39ca48b7977d46d6219c
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=2ee9cbef8a9e3c59263c39ca48b7977d46d6219c

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Sun Aug  5 13:12:29 2012 +0200

core: remove weird switch() statement when scanning checkresult queue #2950

a simple if this does not fit, continue the loop does the trick. in this
it's about checking if the file is "real" and not symlinked. though,
stat(2) does not allow that either, so at least fix the logical bug.

refs #2950

---

 Changelog    |    1 +
 base/utils.c |   17 +++++------------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/Changelog b/Changelog
index b08582c..6d30476 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,7 @@ FIXES
 * core: bail out early with config error if resource.cfg macros contain NULL values #2879 - MF
 * core: fix logical bug on icinga.cfg detection on config read #2879 - MF
 * core: fsync() files before fclose() (Andreas Ericsson) #2948 - MF
+* core: remove weird switch() statement when scanning checkresult queue (Andreas Ericsson) #2950 - MF
 
 * idoutils: fix icinga mysql db creation script grants access to all dbs #2917 - MF
 
diff --git a/base/utils.c b/base/utils.c
index 9ae8304..ed01f1b 100644
--- a/base/utils.c
+++ b/base/utils.c
@@ -2730,19 +2730,12 @@ int process_check_result_queue(char *dirname) {
 				continue;
 			}
 
-			switch (stat_buf.st_mode & S_IFMT) {
-
-			case S_IFREG:
-				/* don't process symlinked files */
-				if (!S_ISREG(stat_buf.st_mode))
-					continue;
-				break;
-
-			default:
-				/* everything else we ignore */
+			/*
+			 * don't process symlinked files, we only care
+			 * about real files
+			 */
+			if (!S_ISREG(stat_buf.st_mode))
 				continue;
-				break;
-			}
 
 			/* at this point we have a regular file... */
 





More information about the icinga-checkins mailing list