Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-11-08 16:07:20 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2023-11-08 16:07:20 +0300
commit58ca629fd27cd9d7f91a8ea90435cdb3f15381aa (patch)
tree6cd26e1bd56e7eed350ff8fa3d4aeecf58ef3a22 /libbb
parent2de67a62e812f2e4d13280f2b78712b6d344cfb7 (diff)
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 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)
}
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)