svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Tue Oct 21 12:36:43 UTC 2008


Author: vda
Date: 2008-10-21 05:36:43 -0700 (Tue, 21 Oct 2008)
New Revision: 23752

Log:
getopt: reinstate erroneously removed getopt() reset code.



Modified:
   trunk/busybox/util-linux/getopt.c


Changeset:
Modified: trunk/busybox/util-linux/getopt.c
===================================================================
--- trunk/busybox/util-linux/getopt.c	2008-10-21 12:24:12 UTC (rev 23751)
+++ trunk/busybox/util-linux/getopt.c	2008-10-21 12:36:43 UTC (rev 23752)
@@ -157,6 +157,15 @@
 	if (quiet_errors) /* No error reporting from getopt(3) */
 		opterr = 0;
 
+	/* We used it already in main() in getopt32(),
+	 * we *must* reset getopt(3): */
+#ifdef __GLIBC__
+	optind = 0;
+#else /* BSD style */
+	optind = 1;
+	/* optreset = 1; */
+#endif
+
 	while (1) {
 		opt =
 #if ENABLE_GETOPT_LONG




More information about the busybox-cvs mailing list