diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-04 23:04:17 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-04 23:04:17 +0200 |
commit | b182e9ad6011909fdb76358431d23d195febaf54 (patch) | |
tree | 650b66e06387f8b0f7fe054a53150809aede7701 /loginutils | |
parent | 692eeb81a4c54d7d8bf0d2e370c12762b2a16ff7 (diff) | |
download | busybox-w32-b182e9ad6011909fdb76358431d23d195febaf54.tar.gz busybox-w32-b182e9ad6011909fdb76358431d23d195febaf54.tar.bz2 busybox-w32-b182e9ad6011909fdb76358431d23d195febaf54.zip |
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 'loginutils')
-rw-r--r-- | loginutils/login.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/loginutils/login.c b/loginutils/login.c index 381468d81..fcdb9592c 100644 --- a/loginutils/login.c +++ b/loginutils/login.c | |||
@@ -350,8 +350,8 @@ int login_main(int argc UNUSED_PARAM, char **argv) | |||
350 | /* Mandatory paranoia for suid applet: | 350 | /* Mandatory paranoia for suid applet: |
351 | * ensure that fd# 0,1,2 are opened (at least to /dev/null) | 351 | * ensure that fd# 0,1,2 are opened (at least to /dev/null) |
352 | * and any extra open fd's are closed. | 352 | * and any extra open fd's are closed. |
353 | * (The name of the function is misleading. Not daemonizing here.) */ | 353 | */ |
354 | bb_daemonize_or_rexec(DAEMON_ONLY_SANITIZE | DAEMON_CLOSE_EXTRA_FDS, NULL); | 354 | bb_daemon_helper(DAEMON_CLOSE_EXTRA_FDS); |
355 | 355 | ||
356 | username[0] = '\0'; | 356 | username[0] = '\0'; |
357 | opt = getopt32(argv, "f:h:p", &opt_user, &opt_host); | 357 | opt = getopt32(argv, "f:h:p", &opt_user, &opt_host); |