aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-01-14 14:45:18 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2019-01-14 14:47:21 +0100
commit088fec36fedff2cd50437c95b7fb430abf8d303c (patch)
treef0dd190ed56fdf4b43710331e3527149903d87d2 /libbb
parentb67d900395a847e29f2afa81198f783004c80fc5 (diff)
downloadbusybox-w32-088fec36fedff2cd50437c95b7fb430abf8d303c.tar.gz
busybox-w32-088fec36fedff2cd50437c95b7fb430abf8d303c.tar.bz2
busybox-w32-088fec36fedff2cd50437c95b7fb430abf8d303c.zip
start-stop-daemon: create pidfile before parent exits, closes 8596
This removes DAEMON_DOUBLE_FORK flag from bb_daemonize_or_rexec(), as SSD was the only user. Also includes fix for -S: now works without -a and -x, does not print pids (compat with "start-stop-daemon (OpenRC) 0.34.11 (Gentoo Linux)"). function old new delta start_stop_daemon_main 1018 1084 +66 add_interface 99 103 +4 fail_hunk 139 136 -3 bb_daemonize_or_rexec 205 183 -22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 70/-25) Total: 45 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/vfork_daemon_rexec.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index c0bea0ed2..1aac27b36 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -292,14 +292,14 @@ void FAST_FUNC bb_daemonize_or_rexec(int flags, char **argv)
292 dup2(fd, 0); 292 dup2(fd, 0);
293 dup2(fd, 1); 293 dup2(fd, 1);
294 dup2(fd, 2); 294 dup2(fd, 2);
295 if (flags & DAEMON_DOUBLE_FORK) { 295// if (flags & DAEMON_DOUBLE_FORK) {
296 /* On Linux, session leader can acquire ctty 296// /* On Linux, session leader can acquire ctty
297 * unknowingly, by opening a tty. 297// * unknowingly, by opening a tty.
298 * Prevent this: stop being a session leader. 298// * Prevent this: stop being a session leader.
299 */ 299// */
300 if (fork_or_rexec(argv)) 300// if (fork_or_rexec(argv))
301 _exit(EXIT_SUCCESS); /* parent */ 301// _exit(EXIT_SUCCESS); /* parent */
302 } 302// }
303 } 303 }
304 while (fd > 2) { 304 while (fd > 2) {
305 close(fd--); 305 close(fd--);