aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-29 07:05:40 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-29 07:05:40 +0000
commit0a44eed81409e05f62e5cb195ed2d72972d3ee22 (patch)
tree13ec20ed6ec7dd51ab4ffe84530d9dd37b77b091 /libbb
parent9d760860836c9f87ac48ca5488333f69cd5b7698 (diff)
downloadbusybox-w32-0a44eed81409e05f62e5cb195ed2d72972d3ee22.tar.gz
busybox-w32-0a44eed81409e05f62e5cb195ed2d72972d3ee22.tar.bz2
busybox-w32-0a44eed81409e05f62e5cb195ed2d72972d3ee22.zip
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 git-svn-id: svn://busybox.net/trunk/busybox@7130 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r--libbb/run_parts.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/run_parts.c b/libbb/run_parts.c
index 58645660b..171d93793 100644
--- a/libbb/run_parts.c
+++ b/libbb/run_parts.c
@@ -47,7 +47,7 @@ static int valid_name(const struct dirent *d)
47 * test_mode = 2 means to fail siliently on missing directories 47 * test_mode = 2 means to fail siliently on missing directories
48 */ 48 */
49 49
50extern int run_parts(char **args, const unsigned char test_mode) 50extern int run_parts(char **args, const unsigned char test_mode, char **env)
51{ 51{
52 struct dirent **namelist = 0; 52 struct dirent **namelist = 0;
53 struct stat st; 53 struct stat st;
@@ -92,7 +92,7 @@ extern int run_parts(char **args, const unsigned char test_mode)
92 bb_perror_msg_and_die("failed to fork"); 92 bb_perror_msg_and_die("failed to fork");
93 } else if (!pid) { 93 } else if (!pid) {
94 args[0] = filename; 94 args[0] = filename;
95 execv(filename, args); 95 execve(filename, args, env);
96 exec_errno = errno; 96 exec_errno = errno;
97 _exit(1); 97 _exit(1);
98 } 98 }