diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-18 14:20:21 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-18 14:20:21 +0000 |
commit | 367960ba9abd66865c810a4d9411741fd25a3854 (patch) | |
tree | d11c311339298c2e0bf9c09d23cdcce6a73c6a42 /libbb/vfork_daemon_rexec.c | |
parent | 9611cb1215fa52200ca5259e3b226df34d0a8045 (diff) | |
download | busybox-w32-367960ba9abd66865c810a4d9411741fd25a3854.tar.gz busybox-w32-367960ba9abd66865c810a4d9411741fd25a3854.tar.bz2 busybox-w32-367960ba9abd66865c810a4d9411741fd25a3854.zip |
make standalone httpd work on NOMMU machines
Diffstat (limited to 'libbb/vfork_daemon_rexec.c')
-rw-r--r-- | libbb/vfork_daemon_rexec.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index f7c620996..558510bc6 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c | |||
@@ -203,6 +203,15 @@ int spawn_and_wait(char **argv) | |||
203 | } | 203 | } |
204 | 204 | ||
205 | #if !BB_MMU | 205 | #if !BB_MMU |
206 | void re_exec(char **argv) | ||
207 | { | ||
208 | /* high-order bit of first char in argv[0] is a hidden | ||
209 | * "we have (already) re-execed, don't do it again" flag */ | ||
210 | argv[0][0] |= 0x80; | ||
211 | execv(bb_busybox_exec_path, argv); | ||
212 | bb_perror_msg_and_die("exec %s", bb_busybox_exec_path); | ||
213 | } | ||
214 | |||
206 | void forkexit_or_rexec(char **argv) | 215 | void forkexit_or_rexec(char **argv) |
207 | { | 216 | { |
208 | pid_t pid; | 217 | pid_t pid; |
@@ -216,11 +225,7 @@ void forkexit_or_rexec(char **argv) | |||
216 | if (pid) /* parent */ | 225 | if (pid) /* parent */ |
217 | exit(0); | 226 | exit(0); |
218 | /* child - re-exec ourself */ | 227 | /* child - re-exec ourself */ |
219 | /* high-order bit of first char in argv[0] is a hidden | 228 | re_exec(argv); |
220 | * "we have (alrealy) re-execed, don't do it again" flag */ | ||
221 | argv[0][0] |= 0x80; | ||
222 | execv(bb_busybox_exec_path, argv); | ||
223 | bb_perror_msg_and_die("exec %s", bb_busybox_exec_path); | ||
224 | } | 229 | } |
225 | #else | 230 | #else |
226 | /* Dance around (void)...*/ | 231 | /* Dance around (void)...*/ |