{ 0, 0, 0, 0 }
};
+extern char **environ;
+
/* run_parts_main */
/* Process options */
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));
}
, security_id_t sid
#endif
);
-extern int run_parts(char **args, const unsigned char test_mode);
+extern int run_parts(char **args, const unsigned char test_mode, char **env);
extern int restricted_shell ( const char *shell );
extern void setup_environment ( const char *shell, int loginshell, int changeenv, const struct passwd *pw );
extern int correct_password ( const struct passwd *pw );
* 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;
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);
}
static int execute_all(struct interface_defn_t *ifd, execfn *exec, const char *opt)
{
int i;
- char *buf;
+ char *buf[2];
for (i = 0; i < ifd->n_options; i++) {
if (strcmp(ifd->option[i].name, opt) == 0) {
}
}
- buf = xmalloc(bb_strlen(opt) + 19);
- sprintf(buf, "/etc/network/if-%s.d", opt);
- run_parts(&buf, 2);
- free(buf);
+ bb_xasprintf(&buf[0], "/etc/network/if-%s.d", opt);
+ buf[1] = NULL;
+
+ run_parts(&buf, 2, environ);
+ free(buf[0]);
return (1);
}