summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko2007-08-18 14:20:21 +0000
committerDenis Vlasenko2007-08-18 14:20:21 +0000
commit367960ba9abd66865c810a4d9411741fd25a3854 (patch)
treed11c311339298c2e0bf9c09d23cdcce6a73c6a42 /libbb
parent9611cb1215fa52200ca5259e3b226df34d0a8045 (diff)
downloadbusybox-367960ba9abd66865c810a4d9411741fd25a3854.zip
busybox-367960ba9abd66865c810a4d9411741fd25a3854.tar.gz
make standalone httpd work on NOMMU machines
Diffstat (limited to 'libbb')
-rw-r--r--libbb/vfork_daemon_rexec.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index f7c6209..558510b 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -203,6 +203,15 @@ int spawn_and_wait(char **argv)
}
#if !BB_MMU
+void re_exec(char **argv)
+{
+ /* high-order bit of first char in argv[0] is a hidden
+ * "we have (already) re-execed, don't do it again" flag */
+ argv[0][0] |= 0x80;
+ execv(bb_busybox_exec_path, argv);
+ bb_perror_msg_and_die("exec %s", bb_busybox_exec_path);
+}
+
void forkexit_or_rexec(char **argv)
{
pid_t pid;
@@ -216,11 +225,7 @@ void forkexit_or_rexec(char **argv)
if (pid) /* parent */
exit(0);
/* child - re-exec ourself */
- /* high-order bit of first char in argv[0] is a hidden
- * "we have (alrealy) re-execed, don't do it again" flag */
- argv[0][0] |= 0x80;
- execv(bb_busybox_exec_path, argv);
- bb_perror_msg_and_die("exec %s", bb_busybox_exec_path);
+ re_exec(argv);
}
#else
/* Dance around (void)...*/