[BusyBox-cvs] busybox/applets busybox.c,1.141,1.142

Glenn McGrath bug1 at busybox.net
Fri Oct 3 13:21:13 UTC 2003


Update of /var/cvs/busybox/applets
In directory winder:/tmp/cvs-serv7638/applets

Modified Files:
	busybox.c 
Log Message:
Reverse my previous changes and make a note about why its dont this way


Index: busybox.c
===================================================================
RCS file: /var/cvs/busybox/applets/busybox.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- busybox.c	3 Oct 2003 07:51:30 -0000	1.141
+++ busybox.c	3 Oct 2003 13:21:10 -0000	1.142
@@ -162,7 +162,18 @@
 	been_there_done_that = 1;
 
 	/* Move the command line down a notch */
-	return (main(argc, argv+1));
+	/* Preserve pointers so setproctitle() works consistently */
+	len = argv[argc] + strlen(argv[argc]) - argv[1];
+	memmove(argv[0], argv[1], len);
+	memset(argv[0] + len, 0, argv[1] - argv[0]);
+
+	/* Fix up the argv pointers */
+	len = argv[1] - argv[0];
+	memmove(argv, argv + 1, sizeof(char *) * (argc + 1));
+	for (i = 0; i < argc; i++)
+		argv[i] -= len;
+
+	return (main(argc, argv));
 }
 
 /*




More information about the busybox-cvs mailing list