diff options
-rw-r--r-- | plugins/check_udp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/check_udp.c b/plugins/check_udp.c index 8626f8c4..4074d948 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c @@ -161,6 +161,9 @@ process_arguments (int argc, char **argv) c = getopt (argc, argv, "+hVvH:e:s:c:w:t:p:"); #endif + if (c == -1 || c == EOF || c == 1) + break; + switch (c) { case '?': /* print short usage statement if args not parsable */ printf ("%s: Unknown argument: %s\n\n", progname, optarg); @@ -212,7 +215,7 @@ process_arguments (int argc, char **argv) } c = optind; - if (server_address == NULL && argv[c]) { + if (server_address == NULL && c < argc && argv[c]) { if (is_host (argv[c]) == FALSE) usage ("Invalid host name/address\n"); server_address = argv[c++]; |