summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko2023-11-08 14:07:20 +0100
committerDenys Vlasenko2023-11-08 14:07:20 +0100
commit58ca629fd27cd9d7f91a8ea90435cdb3f15381aa (patch)
tree6cd26e1bd56e7eed350ff8fa3d4aeecf58ef3a22 /libbb
parent2de67a62e812f2e4d13280f2b78712b6d344cfb7 (diff)
downloadbusybox-58ca629fd27cd9d7f91a8ea90435cdb3f15381aa.zip
busybox-58ca629fd27cd9d7f91a8ea90435cdb3f15381aa.tar.gz
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')
-rw-r--r--libbb/vfork_daemon_rexec.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index a570ddb..2055c4b 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)
}
if (flags & DAEMON_DEVNULL_STDIO) {
- xdup2(fd, 0);
- xdup2(fd, 1);
- xdup2(fd, 2);
+ if (flags & DAEMON_DEVNULL_STDIN)
+ xdup2(fd, 0);
+ if (flags & DAEMON_DEVNULL_OUTERR) {
+ xdup2(fd, 1);
+ xdup2(fd, 2);
+ }
} else {
/* have 0,1,2 open at least to /dev/null */
while ((unsigned)fd < 2)