summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_disk.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 873b17b..d1d1b92 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -117,7 +117,7 @@ enum {
117# pragma alloca 117# pragma alloca
118#endif 118#endif
119 119
120static int process_arguments(int, char **); 120static int process_arguments(int /*argc*/, char ** /*argv*/);
121static void set_all_thresholds(struct parameter_list *path); 121static void set_all_thresholds(struct parameter_list *path);
122static void print_help(void); 122static void print_help(void);
123void print_usage(void); 123void print_usage(void);
@@ -168,7 +168,8 @@ int main(int argc, char **argv) {
168 168
169 struct mount_entry *me; 169 struct mount_entry *me;
170 struct fs_usage fsp; 170 struct fs_usage fsp;
171 struct parameter_list *temp_list, *path; 171 struct parameter_list *temp_list;
172 struct parameter_list *path;
172 173
173#ifdef __CYGWIN__ 174#ifdef __CYGWIN__
174 char mountdir[32]; 175 char mountdir[32];
@@ -286,17 +287,20 @@ int main(int argc, char **argv) {
286 } 287 }
287 continue; 288 continue;
288 /* Skip pseudo fs's if we haven't asked for all fs's */ 289 /* Skip pseudo fs's if we haven't asked for all fs's */
289 } else if (me->me_dummy && !show_all_fs) { 290 }
291 if (me->me_dummy && !show_all_fs) {
290 continue; 292 continue;
291 /* Skip excluded fstypes */ 293 /* Skip excluded fstypes */
292 } else if (fs_exclude_list && np_find_regmatch(fs_exclude_list, me->me_type)) { 294 }
295 if (fs_exclude_list && np_find_regmatch(fs_exclude_list, me->me_type)) {
293 continue; 296 continue;
294 /* Skip excluded fs's */ 297 /* Skip excluded fs's */
295 } else if (dp_exclude_list && 298 }
296 (np_find_name(dp_exclude_list, me->me_devname) || np_find_name(dp_exclude_list, me->me_mountdir))) { 299 if (dp_exclude_list && (np_find_name(dp_exclude_list, me->me_devname) || np_find_name(dp_exclude_list, me->me_mountdir))) {
297 continue; 300 continue;
298 /* Skip not included fstypes */ 301 /* Skip not included fstypes */
299 } else if (fs_include_list && !np_find_regmatch(fs_include_list, me->me_type)) { 302 }
303 if (fs_include_list && !np_find_regmatch(fs_include_list, me->me_type)) {
300 continue; 304 continue;
301 } 305 }
302 } 306 }
@@ -453,9 +457,11 @@ double calculate_percent(uintmax_t value, uintmax_t total) {
453 457
454/* process command-line arguments */ 458/* process command-line arguments */
455int process_arguments(int argc, char **argv) { 459int process_arguments(int argc, char **argv) {
456 int c, err; 460 int c;
461 int err;
457 struct parameter_list *se; 462 struct parameter_list *se;
458 struct parameter_list *temp_list = NULL, *previous = NULL; 463 struct parameter_list *temp_list = NULL;
464 struct parameter_list *previous = NULL;
459 struct mount_entry *me; 465 struct mount_entry *me;
460 regex_t re; 466 regex_t re;
461 int cflags = REG_NOSUB | REG_EXTENDED; 467 int cflags = REG_NOSUB | REG_EXTENDED;
@@ -803,7 +809,8 @@ int process_arguments(int argc, char **argv) {
803 path_ignored = true; 809 path_ignored = true;
804 path_selected = true; 810 path_selected = true;
805 break; 811 break;
806 } else if (!fnd) 812 }
813 if (!fnd)
807 die(STATE_UNKNOWN, "DISK %s: %s - %s\n", _("UNKNOWN"), _("Regular expression did not match any path or disk"), optarg); 814 die(STATE_UNKNOWN, "DISK %s: %s - %s\n", _("UNKNOWN"), _("Regular expression did not match any path or disk"), optarg);
808 815
809 fnd = false; 816 fnd = false;
@@ -1011,10 +1018,9 @@ bool stat_path(struct parameter_list *p) {
1011 printf("stat failed on %s\n", p->name); 1018 printf("stat failed on %s\n", p->name);
1012 if (ignore_missing == true) { 1019 if (ignore_missing == true) {
1013 return false; 1020 return false;
1014 } else {
1015 printf("DISK %s - ", _("CRITICAL"));
1016 die(STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno));
1017 } 1021 }
1022 printf("DISK %s - ", _("CRITICAL"));
1023 die(STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno));
1018 } 1024 }
1019 return true; 1025 return true;
1020} 1026}