diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-11-22 20:19:26 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-11-22 20:19:26 +0400 |
commit | d2277e262ff7dd2dd946ea16b93462f3dcdf0447 (patch) | |
tree | 985e045011ef9eb5b0136ce36c321cce015e56d7 | |
parent | fcb9e07eca65b98093dd0b2b80451934a8719914 (diff) |
nommu: fix cases where we mangle argv[0][0]
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | archival/cpio.c | 1 | ||||
-rw-r--r-- | include/libbb.h | 3 | ||||
-rw-r--r-- | init/bootchartd.c | 2 | ||||
-rw-r--r-- | networking/httpd.c | 1 |
4 files changed, 7 insertions, 0 deletions
diff --git a/archival/cpio.c b/archival/cpio.c index c2a5b8ab9..98cc18fa0 100644 --- a/archival/cpio.c +++ b/archival/cpio.c @@ -384,6 +384,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv) goto dump; } /* parent */ + USE_FOR_NOMMU(argv[-optind][0] &= 0x7f); /* undo fork_or_rexec() damage */ xchdir(*argv++); close(pp.wr); xmove_fd(pp.rd, STDIN_FILENO); diff --git a/include/libbb.h b/include/libbb.h index 3f6fe47ed..bc9b7b06d 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -981,6 +981,9 @@ enum { # define bb_daemonize(flags) bb_daemonize_or_rexec(flags, bogus) #else extern bool re_execed; + /* Note: re_exec() and fork_or_rexec() do argv[0][0] |= 0x80 on NOMMU! + * _Parent_ needs to undo it if it doesn't want to have argv[0] mangled. + */ void re_exec(char **argv) NORETURN FAST_FUNC; pid_t fork_or_rexec(char **argv) FAST_FUNC; int BUG_fork_is_unavailable_on_nommu(void) FAST_FUNC; diff --git a/init/bootchartd.c b/init/bootchartd.c index 5f6121fa4..cc23e6073 100644 --- a/init/bootchartd.c +++ b/init/bootchartd.c @@ -418,6 +418,8 @@ int bootchartd_main(int argc UNUSED_PARAM, char **argv) /* parent */ + USE_FOR_NOMMU(argv[0][0] &= 0x7f); /* undo fork_or_rexec() damage */ + if (DO_SIGNAL_SYNC) { /* Wait for logger child to set handlers, then unpause it. * Otherwise with short-lived PROG (e.g. "bootchartd start true") diff --git a/networking/httpd.c b/networking/httpd.c index 24482fe52..ecdf5b572 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -2243,6 +2243,7 @@ static void mini_httpd_nommu(int server_socket, int argc, char **argv) /* Run a copy of ourself in inetd mode */ re_exec(argv_copy); } + argv_copy[0][0] &= 0x7f; /* parent, or vfork failed */ close(n); } /* while (1) */ |