diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2004-02-09 08:27:54 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2004-02-09 08:27:54 +0000 |
commit | c1261f015e1cdf53d8d8dbc805a982537e2ca29c (patch) | |
tree | 4d6df04932aeba1c3a46a652d1864b9c71528049 /plugins | |
parent | 00e63820065284b352e0d2bcc4969c6cc83bd250 (diff) | |
download | monitoring-plugins-c1261f015e1cdf53d8d8dbc805a982537e2ca29c.tar.gz |
Fix for check_ping old-style argument handling (Patrick McCormick - 892211)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@799 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_ping.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index ab5e0cc3..1d34656c 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -74,7 +74,8 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - addresses = malloc ((size_t)max_addr); + addresses = malloc (sizeof(char*) * max_addr); + addresses[0] = NULL; if (process_arguments (argc, argv) == ERROR) usage (_("Could not parse arguments")); @@ -228,7 +229,7 @@ process_arguments (int argc, char **argv) n_addresses++; if (n_addresses > max_addr) { max_addr *= 2; - addresses = realloc (addresses, (size_t)max_addr); + addresses = realloc (addresses, sizeof(char*) * max_addr); if (addresses == NULL) die (STATE_UNKNOWN, _("Could not realloc() addresses\n")); } @@ -272,6 +273,7 @@ process_arguments (int argc, char **argv) return ERROR; } else { addresses[0] = argv[c++]; + n_addresses++; if (c == argc) return validate_arguments (); } |