[BusyBox-cvs] busybox/libbb run_parts.c,1.8,1.9
Erik Andersen
andersen at busybox.net
Tue Jul 29 07:05:42 UTC 2003
Update of /var/cvs/busybox/libbb
In directory winder:/tmp/cvs-serv8695/libbb
Modified Files:
run_parts.c
Log Message:
Bruno Randolf writes:
this patch fixes run_parts when it's called by ifupdown. 1) argv has to be a
NULL terminated char* array, not just a string. 2) run_parts now explicitly
sets the environment. this environment is populated from the
/etc/network/interfaces config file and is needed by the scripts in
/etc/network/if-pre-up.d/. when run-parts is called from the command line the
environment is taken from the current process.
Vladimir Oleynik then wrote:
You can simplify this if use:
+ bb_xasprintf(&buf[0], "/etc/network/if-%s.d", opt);
+ buf[1] = NULL;
+
+ run_parts(&buf, 2, environ);
+ free(buf[0]);
--w
vodz
Index: run_parts.c
===================================================================
RCS file: /var/cvs/busybox/libbb/run_parts.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- run_parts.c 27 May 2003 20:45:59 -0000 1.8
+++ run_parts.c 29 Jul 2003 07:05:37 -0000 1.9
@@ -47,7 +47,7 @@
* test_mode = 2 means to fail siliently on missing directories
*/
-extern int run_parts(char **args, const unsigned char test_mode)
+extern int run_parts(char **args, const unsigned char test_mode, char **env)
{
struct dirent **namelist = 0;
struct stat st;
@@ -92,7 +92,7 @@
bb_perror_msg_and_die("failed to fork");
} else if (!pid) {
args[0] = filename;
- execv(filename, args);
+ execve(filename, args, env);
exec_errno = errno;
_exit(1);
}
More information about the busybox-cvs
mailing list