From b0d5270f0a2e688e6ba44dde8011dfae63bbf754 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Tue, 18 Feb 2003 22:24:35 +0000 Subject: [PATCH] never exited getopt loop git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@342 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_udp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/check_udp.c b/plugins/check_udp.c index 8626f8c..4074d94 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++]; -- 2.30.2