diff options
author | Denys Vlasenko | 2017-08-04 23:04:17 +0200 |
---|---|---|
committer | Denys Vlasenko | 2017-08-04 23:04:17 +0200 |
commit | b182e9ad6011909fdb76358431d23d195febaf54 (patch) | |
tree | 650b66e06387f8b0f7fe054a53150809aede7701 /console-tools/openvt.c | |
parent | 692eeb81a4c54d7d8bf0d2e370c12762b2a16ff7 (diff) | |
download | busybox-b182e9ad6011909fdb76358431d23d195febaf54.zip busybox-b182e9ad6011909fdb76358431d23d195febaf54.tar.gz |
libbb: use _exit, not exit, in bb_daemonize_or_rexec()
By the time we reach exit in parent, child already exited or execed.
We should not re-run libc cleanup code.
While at it, introduce bb_daemon_helper() and add a few comments.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'console-tools/openvt.c')
-rw-r--r-- | console-tools/openvt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/console-tools/openvt.c b/console-tools/openvt.c index f3db283..423122f 100644 --- a/console-tools/openvt.c +++ b/console-tools/openvt.c @@ -99,7 +99,7 @@ static int find_free_vtno(void) /*xfunc_error_retval = 3; - do we need compat? */ if (ioctl(fd, VT_OPENQRY, &vtno) != 0 || vtno <= 0) bb_perror_msg_and_die("can't find open VT"); -// Not really needed, grep for DAEMON_ONLY_SANITIZE +// Not really needed, grep for DAEMON_CLOSE_EXTRA_FDS // if (fd > 2) // close(fd); return vtno; @@ -155,7 +155,7 @@ int openvt_main(int argc UNUSED_PARAM, char **argv) /* Grab new VT */ sprintf(vtname, VC_FORMAT, vtno); /* (Try to) clean up stray open fds above fd 2 */ - bb_daemonize_or_rexec(DAEMON_CLOSE_EXTRA_FDS | DAEMON_ONLY_SANITIZE, NULL); + bb_daemon_helper(DAEMON_CLOSE_EXTRA_FDS); close(STDIN_FILENO); /*setsid(); - BAD IDEA: after we exit, child is SIGHUPed... */ xopen(vtname, O_RDWR); |