diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-11-08 14:07:20 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-11-08 14:07:20 +0100 |
commit | 58ca629fd27cd9d7f91a8ea90435cdb3f15381aa (patch) | |
tree | 6cd26e1bd56e7eed350ff8fa3d4aeecf58ef3a22 /libbb/vfork_daemon_rexec.c | |
parent | 2de67a62e812f2e4d13280f2b78712b6d344cfb7 (diff) | |
download | busybox-w32-58ca629fd27cd9d7f91a8ea90435cdb3f15381aa.tar.gz busybox-w32-58ca629fd27cd9d7f91a8ea90435cdb3f15381aa.tar.bz2 busybox-w32-58ca629fd27cd9d7f91a8ea90435cdb3f15381aa.zip |
start-stop-daemon: do not lose error messages with -b
function old new delta
start_stop_daemon_main 1186 1206 +20
bb_daemonize_or_rexec 196 212 +16
bb_banner 47 46 -1
packed_usage 34656 34645 -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 36/-12) Total: 24 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/vfork_daemon_rexec.c')
-rw-r--r-- | libbb/vfork_daemon_rexec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index a570ddbf2..2055c4b71 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c | |||
@@ -296,9 +296,12 @@ void FAST_FUNC bb_daemonize_or_rexec(int flags, char **argv) | |||
296 | } | 296 | } |
297 | 297 | ||
298 | if (flags & DAEMON_DEVNULL_STDIO) { | 298 | if (flags & DAEMON_DEVNULL_STDIO) { |
299 | xdup2(fd, 0); | 299 | if (flags & DAEMON_DEVNULL_STDIN) |
300 | xdup2(fd, 1); | 300 | xdup2(fd, 0); |
301 | xdup2(fd, 2); | 301 | if (flags & DAEMON_DEVNULL_OUTERR) { |
302 | xdup2(fd, 1); | ||
303 | xdup2(fd, 2); | ||
304 | } | ||
302 | } else { | 305 | } else { |
303 | /* have 0,1,2 open at least to /dev/null */ | 306 | /* have 0,1,2 open at least to /dev/null */ |
304 | while ((unsigned)fd < 2) | 307 | while ((unsigned)fd < 2) |