aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_disk.c
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-08-08 16:49:32 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-08-08 16:49:32 +0000
commit930650812a19245a8d45853064e8fe32d87f71f2 (patch)
tree17146c824e305cf399257ce4dbd546e5e0f63183 /plugins/check_disk.c
parent45b8e6933cb118565efd8807ca8d80ed8e7422f4 (diff)
downloadmonitoring-plugins-930650812a19245a8d45853064e8fe32d87f71f2.tar.gz
cleanups from pedantic complier warnings
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@666 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_disk.c')
-rw-r--r--plugins/check_disk.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index f6966721..bd060218 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -233,9 +233,10 @@ process_arguments (int argc, char **argv)
struct name_list **fstail = &fs_exclude_list;
struct name_list **dptail = &dp_exclude_list;
struct name_list *temp_list;
- unsigned long l;
int result = OK;
+ unsigned long l;
+
int option_index = 0;
static struct option long_options[] = {
{"timeout", required_argument, 0, 't'},
@@ -322,6 +323,8 @@ process_arguments (int argc, char **argv)
usage (_("Critical threshold must be integer or percentage!\n"));
}
case 'u':
+ if (units)
+ free(units);
if (! strcmp (optarg, "bytes")) {
mult = (uintmax_t)1;
units = strdup ("B");
@@ -340,13 +343,19 @@ process_arguments (int argc, char **argv)
} else {
die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
}
+ if (units == NULL)
+ die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units");
break;
case 'k': /* display mountpoint */
mult = 1024;
+ if (units)
+ free(units);
units = strdup ("kB");
break;
case 'm': /* display mountpoint */
mult = 1024 * 1024;
+ if (units)
+ free(units);
units = strdup ("kB");
break;
case 'l':
@@ -475,8 +484,10 @@ INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greate
return ERROR;
}
- if (units == NULL)
+ if (units == NULL) {
units = strdup ("MB");
+ mult = (uintmax_t)1024 * 1024;
+ }
return OK;
}