aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/usage.h12
-rw-r--r--networking/ifplugd.c24
2 files changed, 15 insertions, 21 deletions
diff --git a/include/usage.h b/include/usage.h
index 4254e153c..8c5a2dbc5 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -130,7 +130,7 @@
130 "Options:" \ 130 "Options:" \
131 "\n -v VAR=VAL Set variable" \ 131 "\n -v VAR=VAL Set variable" \
132 "\n -F SEP Use SEP as field separator" \ 132 "\n -F SEP Use SEP as field separator" \
133 "\n -f FILE Read program from file" \ 133 "\n -f FILE Read program from FILE" \
134 134
135#define basename_trivial_usage \ 135#define basename_trivial_usage \
136 "FILE [SUFFIX]" 136 "FILE [SUFFIX]"
@@ -291,7 +291,7 @@
291 "chat '' ATZ OK ATD123456 CONNECT '' ogin: pppuser word: ppppass '~'" \ 291 "chat '' ATZ OK ATD123456 CONNECT '' ogin: pppuser word: ppppass '~'" \
292 292
293#define chattr_trivial_usage \ 293#define chattr_trivial_usage \
294 "[-R] [-+=AacDdijsStTu] [-v version] files..." 294 "[-R] [-+=AacDdijsStTu] [-v VERSION] [FILE]..."
295#define chattr_full_usage "\n\n" \ 295#define chattr_full_usage "\n\n" \
296 "Change file attributes on an ext2 fs\n" \ 296 "Change file attributes on an ext2 fs\n" \
297 "\nModifiers:" \ 297 "\nModifiers:" \
@@ -4777,9 +4777,9 @@
4777 "\n -H,-h,--hostname=HOSTNAME Client hostname" \ 4777 "\n -H,-h,--hostname=HOSTNAME Client hostname" \
4778 "\n -c,--clientid=CLIENTID Client identifier" \ 4778 "\n -c,--clientid=CLIENTID Client identifier" \
4779 "\n -C,--clientid-none Suppress default client identifier" \ 4779 "\n -C,--clientid-none Suppress default client identifier" \
4780 "\n -p,--pidfile=file Create pidfile" \ 4780 "\n -p,--pidfile=FILE Create pidfile" \
4781 "\n -r,--request=IP IP address to request" \ 4781 "\n -r,--request=IP IP address to request" \
4782 "\n -s,--script=file Run file at DHCP events (default "CONFIG_UDHCPC_DEFAULT_SCRIPT")" \ 4782 "\n -s,--script=FILE Run FILE at DHCP events (default "CONFIG_UDHCPC_DEFAULT_SCRIPT")" \
4783 "\n -t,--retries=N Send up to N discover packets" \ 4783 "\n -t,--retries=N Send up to N discover packets" \
4784 "\n -T,--timeout=N Pause between packets (default 3 seconds)" \ 4784 "\n -T,--timeout=N Pause between packets (default 3 seconds)" \
4785 "\n -A,--tryagain=N Wait N seconds (default 20) after failure" \ 4785 "\n -A,--tryagain=N Wait N seconds (default 20) after failure" \
@@ -4806,9 +4806,9 @@
4806 "\n -H,-h HOSTNAME Client hostname" \ 4806 "\n -H,-h HOSTNAME Client hostname" \
4807 "\n -c CLIENTID Client identifier" \ 4807 "\n -c CLIENTID Client identifier" \
4808 "\n -C Suppress default client identifier" \ 4808 "\n -C Suppress default client identifier" \
4809 "\n -p file Create pidfile" \ 4809 "\n -p FILE Create pidfile" \
4810 "\n -r IP IP address to request" \ 4810 "\n -r IP IP address to request" \
4811 "\n -s file Run file at DHCP events (default "CONFIG_UDHCPC_DEFAULT_SCRIPT")" \ 4811 "\n -s FILE Run FILE at DHCP events (default "CONFIG_UDHCPC_DEFAULT_SCRIPT")" \
4812 "\n -t N Send up to N request packets" \ 4812 "\n -t N Send up to N request packets" \
4813 "\n -T N Try to get a lease for N seconds (default 3)" \ 4813 "\n -T N Try to get a lease for N seconds (default 3)" \
4814 "\n -A N Wait N seconds (default 20) after failure" \ 4814 "\n -A N Wait N seconds (default 20) after failure" \
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 6efad22eb..458553013 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -119,29 +119,23 @@ struct globals {
119 119
120static int run_script(const char *action) 120static int run_script(const char *action)
121{ 121{
122 pid_t pid; 122 char *argv[5];
123 int r; 123 int r;
124 124
125 bb_error_msg("executing '%s %s %s'", G.script_name, G.iface, action); 125 bb_error_msg("executing '%s %s %s'", G.script_name, G.iface, action);
126 126
127#if 1 127#if 1
128 pid = vfork();
129 if (pid < 0) {
130 bb_perror_msg("fork");
131 return -1;
132 }
133 128
134 if (pid == 0) { 129 argv[0] = (char*) G.script_name;
135 /* child */ 130 argv[1] = (char*) G.iface;
136 execlp(G.script_name, G.script_name, G.iface, action, G.extra_arg, NULL); 131 argv[2] = (char*) action;
137 bb_perror_msg_and_die("can't execute '%s'", G.script_name); 132 argv[3] = (char*) G.extra_arg;
138 } 133 argv[4] = NULL;
139 134
140 /* parent */ 135 /* r < 0 - can't exec, 0 <= r < 1000 - exited, >1000 - killed by sig (r-1000) */
141 wait(&r); 136 r = wait4pid(spawn(argv));
142 r = WEXITSTATUS(r);
143 137
144 bb_error_msg("exit code: %u", r); 138 bb_error_msg("exit code: %d", r);
145 return (option_mask32 & FLAG_IGNORE_RETVAL) ? 0 : r; 139 return (option_mask32 & FLAG_IGNORE_RETVAL) ? 0 : r;
146 140
147#else /* insanity */ 141#else /* insanity */