about summary refs log tree commit diff
path: root/posix/getopt.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-31 05:03:53 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-31 05:03:53 +0000
commit05c54d4c8e2e81c08a0fa220b299dade7c9a622e (patch)
tree3655e7b46e50e648df480416f8c3f456ac4e0732 /posix/getopt.c
parent7f4e0e588681d0670c78472f81c21e63bb5772d6 (diff)
downloadglibc-05c54d4c8e2e81c08a0fa220b299dade7c9a622e.tar.gz
glibc-05c54d4c8e2e81c08a0fa220b299dade7c9a622e.tar.xz
glibc-05c54d4c8e2e81c08a0fa220b299dade7c9a622e.zip
Update.
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).
Diffstat (limited to 'posix/getopt.c')
-rw-r--r--posix/getopt.c3
1 files changed, 3 insertions, 0 deletions
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)