diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/vfork_daemon_rexec.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index 7914193..a570ddb 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c @@ -268,10 +268,12 @@ pid_t FAST_FUNC fork_or_rexec(char **argv) /* fflush_all(); ? - so far all callers had no buffered output to flush */ pid = xvfork(); - if (pid) /* parent */ - return pid; - /* child - re-exec ourself */ - re_exec(argv); + if (pid == 0) /* child - re-exec ourself */ + re_exec(argv); /* NORETURN */ + + /* parent */ + argv[0][0] &= 0x7f; /* undo re_rexec() damage */ + return pid; } #endif |