summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath2002-11-21 22:17:11 +0000
committerGlenn L McGrath2002-11-21 22:17:11 +0000
commit157fea5960e753cae5744457e98cdcbfa17358c4 (patch)
treea5283e7e3560b1f1b4b721eccec1a0b25943be67
parent82701e4d678aa4242befe5d6073548bc29ddb10f (diff)
downloadbusybox-157fea5960e753cae5744457e98cdcbfa17358c4.zip
busybox-157fea5960e753cae5744457e98cdcbfa17358c4.tar.gz
Fix a vfork bug, by Nick Fedchik and Vladimir N. Oleynik
-rw-r--r--libbb/run_parts.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libbb/run_parts.c b/libbb/run_parts.c
index 8399a6a..6df51a1 100644
--- a/libbb/run_parts.c
+++ b/libbb/run_parts.c
@@ -50,6 +50,7 @@ extern int run_parts(char **args, const unsigned char test_mode)
struct dirent **namelist = 0;
struct stat st;
char *filename;
+ char *arg0 = args[0];
int entries;
int i;
int exitstatus = 0;
@@ -60,15 +61,15 @@ extern int run_parts(char **args, const unsigned char test_mode)
(void) &exitstatus;
#endif
/* scandir() isn't POSIX, but it makes things easy. */
- entries = scandir(args[0], &namelist, valid_name, alphasort);
+ entries = scandir(arg0, &namelist, valid_name, alphasort);
if (entries == -1) {
- perror_msg_and_die("failed to open directory %s", args[0]);
+ perror_msg_and_die("failed to open directory %s", arg0);
}
for (i = 0; i < entries; i++) {
- filename = concat_path_file(args[0], namelist[i]->d_name);
+ filename = concat_path_file(arg0, namelist[i]->d_name);
if (stat(filename, &st) < 0) {
perror_msg_and_die("failed to stat component %s", filename);