summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2004-02-09 08:27:54 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2004-02-09 08:27:54 (GMT)
commitc1261f015e1cdf53d8d8dbc805a982537e2ca29c (patch)
tree4d6df04932aeba1c3a46a652d1864b9c71528049
parent00e63820065284b352e0d2bcc4969c6cc83bd250 (diff)
downloadmonitoring-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
-rw-r--r--plugins/check_ping.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index ab5e0cc..1d34656 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -74,7 +74,8 @@ main (int argc, char **argv)
74 bindtextdomain (PACKAGE, LOCALEDIR); 74 bindtextdomain (PACKAGE, LOCALEDIR);
75 textdomain (PACKAGE); 75 textdomain (PACKAGE);
76 76
77 addresses = malloc ((size_t)max_addr); 77 addresses = malloc (sizeof(char*) * max_addr);
78 addresses[0] = NULL;
78 79
79 if (process_arguments (argc, argv) == ERROR) 80 if (process_arguments (argc, argv) == ERROR)
80 usage (_("Could not parse arguments")); 81 usage (_("Could not parse arguments"));
@@ -228,7 +229,7 @@ process_arguments (int argc, char **argv)
228 n_addresses++; 229 n_addresses++;
229 if (n_addresses > max_addr) { 230 if (n_addresses > max_addr) {
230 max_addr *= 2; 231 max_addr *= 2;
231 addresses = realloc (addresses, (size_t)max_addr); 232 addresses = realloc (addresses, sizeof(char*) * max_addr);
232 if (addresses == NULL) 233 if (addresses == NULL)
233 die (STATE_UNKNOWN, _("Could not realloc() addresses\n")); 234 die (STATE_UNKNOWN, _("Could not realloc() addresses\n"));
234 } 235 }
@@ -272,6 +273,7 @@ process_arguments (int argc, char **argv)
272 return ERROR; 273 return ERROR;
273 } else { 274 } else {
274 addresses[0] = argv[c++]; 275 addresses[0] = argv[c++];
276 n_addresses++;
275 if (c == argc) 277 if (c == argc)
276 return validate_arguments (); 278 return validate_arguments ();
277 } 279 }