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

git at icinga.org git at icinga.org
Tue Aug 7 15:34:45 CEST 2012


Module: icinga-core
Branch: mfriedrich/core
Commit: a3eff50d8d372ef7fb5d14edd1f0b5050a917558
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=a3eff50d8d372ef7fb5d14edd1f0b5050a917558

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

---

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

diff --git a/base/utils.c b/base/utils.c
index b8cf12b..d174afc 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