mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-15 22:00:06 -04:00
never exited getopt loop
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@342 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
2bd8a33c8d
commit
b0d5270f0a
1 changed files with 4 additions and 1 deletions
|
|
@ -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++];
|
||||
|
|
|
|||
Loading…
Reference in a new issue