diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-10-18 16:16:44 +0200 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-10-18 16:16:44 +0200 |
commit | b6796d9172717a7dd718522b8f461a1452372a96 (patch) | |
tree | e2fbf1c89abcae94dc34b24dd6864b40e02564e8 | |
parent | bafe2c2ceb522f74f22104c8cebe62b177ff46e4 (diff) | |
download | monitoring-plugins-b6796d9172717a7dd718522b8f461a1452372a96.tar.gz |
check_disk: Use C99 booleans
-rw-r--r-- | plugins/check_disk.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 2f066c7b..a4180ca7 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -135,12 +135,12 @@ char *exclude_device; | |||
135 | char *units; | 135 | char *units; |
136 | uintmax_t mult = 1024 * 1024; | 136 | uintmax_t mult = 1024 * 1024; |
137 | int verbose = 0; | 137 | int verbose = 0; |
138 | int erronly = FALSE; | 138 | bool erronly = false; |
139 | int display_mntp = FALSE; | 139 | bool display_mntp = false; |
140 | int exact_match = FALSE; | 140 | bool exact_match = false; |
141 | bool ignore_missing = false; | 141 | bool ignore_missing = false; |
142 | int freespace_ignore_reserved = FALSE; | 142 | bool freespace_ignore_reserved = false; |
143 | int display_inodes_perfdata = FALSE; | 143 | bool display_inodes_perfdata = false; |
144 | char *warn_freespace_units = NULL; | 144 | char *warn_freespace_units = NULL; |
145 | char *crit_freespace_units = NULL; | 145 | char *crit_freespace_units = NULL; |
146 | char *warn_freespace_percent = NULL; | 146 | char *warn_freespace_percent = NULL; |
@@ -153,7 +153,7 @@ char *warn_usedinodes_percent = NULL; | |||
153 | char *crit_usedinodes_percent = NULL; | 153 | char *crit_usedinodes_percent = NULL; |
154 | char *warn_freeinodes_percent = NULL; | 154 | char *warn_freeinodes_percent = NULL; |
155 | char *crit_freeinodes_percent = NULL; | 155 | char *crit_freeinodes_percent = NULL; |
156 | int path_selected = FALSE; | 156 | bool path_selected = false; |
157 | bool path_ignored = false; | 157 | bool path_ignored = false; |
158 | char *group = NULL; | 158 | char *group = NULL; |
159 | struct stat *stat_buf; | 159 | struct stat *stat_buf; |
@@ -205,7 +205,7 @@ main (int argc, char **argv) | |||
205 | /* If a list of paths has not been selected, find entire | 205 | /* If a list of paths has not been selected, find entire |
206 | mount list and create list of paths | 206 | mount list and create list of paths |
207 | */ | 207 | */ |
208 | if (path_selected == FALSE && path_ignored == false) { | 208 | if (path_selected == false && path_ignored == false) { |
209 | for (me = mount_list; me; me = me->me_next) { | 209 | for (me = mount_list; me; me = me->me_next) { |
210 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) { | 210 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) { |
211 | path = np_add_parameter(&path_select_list, me->me_mountdir); | 211 | path = np_add_parameter(&path_select_list, me->me_mountdir); |
@@ -396,10 +396,10 @@ main (int argc, char **argv) | |||
396 | perfdata_uint64 ( | 396 | perfdata_uint64 ( |
397 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | 397 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, |
398 | path->dused_units * mult, "B", | 398 | path->dused_units * mult, "B", |
399 | (warning_high_tide == UINT64_MAX ? FALSE : TRUE), warning_high_tide, | 399 | (warning_high_tide == UINT64_MAX ? false : true), warning_high_tide, |
400 | (critical_high_tide == UINT64_MAX ? FALSE : TRUE), critical_high_tide, | 400 | (critical_high_tide == UINT64_MAX ? false : true), critical_high_tide, |
401 | TRUE, 0, | 401 | true, 0, |
402 | TRUE, path->dtotal_units * mult)); | 402 | true, path->dtotal_units * mult)); |
403 | 403 | ||
404 | if (display_inodes_perfdata) { | 404 | if (display_inodes_perfdata) { |
405 | /* *_high_tide must be reinitialized at each run */ | 405 | /* *_high_tide must be reinitialized at each run */ |
@@ -418,10 +418,10 @@ main (int argc, char **argv) | |||
418 | xasprintf (&perf, "%s %s", perf, | 418 | xasprintf (&perf, "%s %s", perf, |
419 | perfdata_uint64 (perf_ilabel, | 419 | perfdata_uint64 (perf_ilabel, |
420 | path->inodes_used, "", | 420 | path->inodes_used, "", |
421 | (warning_high_tide != UINT64_MAX ? TRUE : FALSE), warning_high_tide, | 421 | (warning_high_tide != UINT64_MAX ? true : false), warning_high_tide, |
422 | (critical_high_tide != UINT64_MAX ? TRUE : FALSE), critical_high_tide, | 422 | (critical_high_tide != UINT64_MAX ? true : false), critical_high_tide, |
423 | TRUE, 0, | 423 | true, 0, |
424 | TRUE, path->inodes_total)); | 424 | true, path->inodes_total)); |
425 | } | 425 | } |
426 | 426 | ||
427 | if (disk_result==STATE_OK && erronly && !verbose) | 427 | if (disk_result==STATE_OK && erronly && !verbose) |
@@ -710,7 +710,7 @@ process_arguments (int argc, char **argv) | |||
710 | mount_list = read_file_system_list (0); | 710 | mount_list = read_file_system_list (0); |
711 | np_set_best_match(se, mount_list, exact_match); | 711 | np_set_best_match(se, mount_list, exact_match); |
712 | 712 | ||
713 | path_selected = TRUE; | 713 | path_selected = true; |
714 | break; | 714 | break; |
715 | case 'x': /* exclude path or partition */ | 715 | case 'x': /* exclude path or partition */ |
716 | np_add_name(&dp_exclude_list, optarg); | 716 | np_add_name(&dp_exclude_list, optarg); |
@@ -734,18 +734,18 @@ process_arguments (int argc, char **argv) | |||
734 | break; | 734 | break; |
735 | case 'q': /* TODO: this function should eventually go away (removed 2007-09-20) */ | 735 | case 'q': /* TODO: this function should eventually go away (removed 2007-09-20) */ |
736 | /* verbose--; **replaced by line below**. -q was only a broken way of implementing -e */ | 736 | /* verbose--; **replaced by line below**. -q was only a broken way of implementing -e */ |
737 | erronly = TRUE; | 737 | erronly = true; |
738 | break; | 738 | break; |
739 | case 'e': | 739 | case 'e': |
740 | erronly = TRUE; | 740 | erronly = true; |
741 | break; | 741 | break; |
742 | case 'E': | 742 | case 'E': |
743 | if (path_selected) | 743 | if (path_selected) |
744 | die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set -E before selecting paths\n")); | 744 | die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set -E before selecting paths\n")); |
745 | exact_match = TRUE; | 745 | exact_match = true; |
746 | break; | 746 | break; |
747 | case 'f': | 747 | case 'f': |
748 | freespace_ignore_reserved = TRUE; | 748 | freespace_ignore_reserved = true; |
749 | break; | 749 | break; |
750 | case 'g': | 750 | case 'g': |
751 | if (path_selected) | 751 | if (path_selected) |
@@ -817,7 +817,7 @@ process_arguments (int argc, char **argv) | |||
817 | 817 | ||
818 | for (me = mount_list; me; me = me->me_next) { | 818 | for (me = mount_list; me; me = me->me_next) { |
819 | if (np_regex_match_mount_entry(me, &re)) { | 819 | if (np_regex_match_mount_entry(me, &re)) { |
820 | fnd = TRUE; | 820 | fnd = true; |
821 | if (verbose >= 3) | 821 | if (verbose >= 3) |
822 | printf("%s %s matching expression %s\n", me->me_devname, me->me_mountdir, optarg); | 822 | printf("%s %s matching expression %s\n", me->me_devname, me->me_mountdir, optarg); |
823 | 823 | ||
@@ -832,24 +832,24 @@ process_arguments (int argc, char **argv) | |||
832 | 832 | ||
833 | if (!fnd && ignore_missing == true) { | 833 | if (!fnd && ignore_missing == true) { |
834 | path_ignored = true; | 834 | path_ignored = true; |
835 | /* path_selected = TRUE;*/ | 835 | /* path_selected = true;*/ |
836 | break; | 836 | break; |
837 | } else if (!fnd) | 837 | } else if (!fnd) |
838 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), | 838 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), |
839 | _("Regular expression did not match any path or disk"), optarg); | 839 | _("Regular expression did not match any path or disk"), optarg); |
840 | 840 | ||
841 | fnd = FALSE; | 841 | fnd = false; |
842 | path_selected = TRUE; | 842 | path_selected = true; |
843 | np_set_best_match(path_select_list, mount_list, exact_match); | 843 | np_set_best_match(path_select_list, mount_list, exact_match); |
844 | cflags = default_cflags; | 844 | cflags = default_cflags; |
845 | 845 | ||
846 | break; | 846 | break; |
847 | case 'M': /* display mountpoint */ | 847 | case 'M': /* display mountpoint */ |
848 | display_mntp = TRUE; | 848 | display_mntp = true; |
849 | break; | 849 | break; |
850 | case 'C': | 850 | case 'C': |
851 | /* add all mount entries to path_select list if no partitions have been explicitly defined using -p */ | 851 | /* add all mount entries to path_select list if no partitions have been explicitly defined using -p */ |
852 | if (path_selected == FALSE) { | 852 | if (path_selected == false) { |
853 | struct parameter_list *path; | 853 | struct parameter_list *path; |
854 | for (me = mount_list; me; me = me->me_next) { | 854 | for (me = mount_list; me; me = me->me_next) { |
855 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) | 855 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) |
@@ -872,7 +872,7 @@ process_arguments (int argc, char **argv) | |||
872 | warn_freeinodes_percent = NULL; | 872 | warn_freeinodes_percent = NULL; |
873 | crit_freeinodes_percent = NULL; | 873 | crit_freeinodes_percent = NULL; |
874 | 874 | ||
875 | path_selected = FALSE; | 875 | path_selected = false; |
876 | group = NULL; | 876 | group = NULL; |
877 | break; | 877 | break; |
878 | case 'V': /* version */ | 878 | case 'V': /* version */ |
@@ -896,7 +896,7 @@ process_arguments (int argc, char **argv) | |||
896 | 896 | ||
897 | if (argc > c) { | 897 | if (argc > c) { |
898 | se = np_add_parameter(&path_select_list, strdup(argv[c++])); | 898 | se = np_add_parameter(&path_select_list, strdup(argv[c++])); |
899 | path_selected = TRUE; | 899 | path_selected = true; |
900 | set_all_thresholds(se); | 900 | set_all_thresholds(se); |
901 | } | 901 | } |
902 | 902 | ||
@@ -905,7 +905,7 @@ process_arguments (int argc, char **argv) | |||
905 | mult = (uintmax_t)1024 * 1024; | 905 | mult = (uintmax_t)1024 * 1024; |
906 | } | 906 | } |
907 | 907 | ||
908 | return TRUE; | 908 | return true; |
909 | } | 909 | } |
910 | 910 | ||
911 | 911 | ||