start: don't unconditionally open("/dev/null")

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-07-09 14:28:57 +02:00
parent 87e0e27360
commit f4c177c3b3
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -1274,13 +1274,13 @@ static int do_start(void *data)
close(handler->sigfd);
if (devnull_fd < 0) {
devnull_fd = open_devnull();
if (devnull_fd < 0)
goto out_warn_father;
}
if (handler->conf->console.slave < 0 && handler->backgrounded) {
if (devnull_fd < 0) {
devnull_fd = open_devnull();
if (devnull_fd < 0)
goto out_warn_father;
}
ret = set_stdfds(devnull_fd);
if (ret < 0) {
ERROR("Failed to redirect std{in,out,err} to \"/dev/null\"");