diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | posix/getopt.c | 3 |
2 files changed, 9 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2000-03-30 Ulrich Drepper <drepper@redhat.com> + + * posix/getopt.c (_getopt_internal): Return -1 if argc < 1. + Reported by Andrew Wiseman <a.wiseman@bandc.dircon.co.uk> + (PR libc/1677). + 2000-03-30 Andreas Jaeger <aj@suse.de> * misc/sys/cdefs.h: Remove K&R support. diff --git a/posix/getopt.c b/posix/getopt.c index 4744e43390..f1add57292 100644 --- a/posix/getopt.c +++ b/posix/getopt.c @@ -521,6 +521,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (optstring[0] == ':') print_errors = 0; + if (argc < 1) + return -1; + optarg = NULL; if (optind == 0 || !__getopt_initialized) |