nsenter,unshare: share common code; fix a bug of not closing all fds
function old new delta xvfork_parent_waits_and_exits - 64 +64 exec_prog_or_SHELL - 39 +39 unshare_main 873 810 -63 nsenter_main 663 596 -67 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/2 up/down: 106/-130) Total: -27 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
c87e81f944
commit
8220399173
5 changed files with 38 additions and 35 deletions
|
@ -659,3 +659,19 @@ pid_t FAST_FUNC xfork(void)
|
|||
return pid;
|
||||
}
|
||||
#endif
|
||||
|
||||
void FAST_FUNC xvfork_parent_waits_and_exits(void)
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
fflush_all();
|
||||
pid = xvfork();
|
||||
if (pid > 0) {
|
||||
/* Parent */
|
||||
int exit_status = wait_for_exitstatus(pid);
|
||||
if (WIFSIGNALED(exit_status))
|
||||
kill_myself_with_sig(WTERMSIG(exit_status));
|
||||
_exit(WEXITSTATUS(exit_status));
|
||||
}
|
||||
/* Child continues */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue