On Sun, 2008-01-27 at 22:05 +0000, Denis Vlasenko wrote:
> On Saturday 26 January 2008 07:19, Roy Marples wrote:
> > 
> > On Fri, 2008-01-25 at 22:55 +0000, Denis Vlasenko wrote:
> > > Can you post your .config?
> > 
> > Attached.
> 
> Aha. CONFIG_FEATURE_PREFER_APPLETS=y!
> 
> Can you test something for me? Go to
> libbb/vfork_daemon_rexec.c and add getopt reset code
> (indicated by '+'):

Right idea, but wrong place.
It's needed in getopt32.c
Patch as attached.

Thanks

Roy
diff -ur busybox-1.9.0.orig/libbb/getopt32.c busybox-1.9.0/libbb/getopt32.c
--- busybox-1.9.0.orig/libbb/getopt32.c	2007-12-21 22:00:29.000000000 +0000
+++ busybox-1.9.0/libbb/getopt32.c	2008-01-28 11:05:29.000000000 +0000
@@ -474,13 +474,18 @@
 	}
 
 	/* In case getopt32 was already called, reinit some state */
+#ifdef __GLIBC__
+	optind = 0;
+#else /* BSD Style */
 	optind = 1;
+#endif
 	/* optarg = NULL; opterr = 0; optopt = 0; ?? */
 
 	/* Note: just "getopt() <= 0" will not work good for
 	 * "fake" short options, like this one:
 	 * wget $'-\203' "Test: test" http://kernel.org/
 	 * (supposed to act as --header, but doesn't) */
+
 #if ENABLE_GETOPT_LONG
 	while ((c = getopt_long(argc, argv, applet_opts,
 			long_options, NULL)) != -1) {
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to