From 2a186890ee664be41b8f9ea572a9ae3498f06eca Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 29 Jul 2003 07:05:40 +0000 Subject: 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 --- debianutils/run_parts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'debianutils') diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index 98fd588..53d33ce 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c @@ -61,6 +61,8 @@ static const struct option runparts_long_options[] = { { 0, 0, 0, 0 } }; +extern char **environ; + /* run_parts_main */ /* Process options */ int run_parts_main(int argc, char **argv) @@ -108,5 +110,5 @@ int run_parts_main(int argc, char **argv) args[0] = argv[optind]; args[argcount] = 0; - return(run_parts(args, test_mode)); + return(run_parts(args, test_mode, environ)); } -- cgit v1.1