make standalone httpd work on NOMMU machines

This commit is contained in:
Denis Vlasenko
2007-08-18 14:20:21 +00:00
parent 9611cb1215
commit 367960ba9a
3 changed files with 103 additions and 54 deletions

View File

@@ -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)...*/