From: Christian Brauner Date: Mon, 9 Jul 2018 12:28:57 +0000 (+0200) Subject: start: don't unconditionally open("/dev/null") X-Git-Tag: lxc-3.1.0~214^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2452%2Fhead;p=thirdparty%2Flxc.git start: don't unconditionally open("/dev/null") Signed-off-by: Christian Brauner --- diff --git a/src/lxc/start.c b/src/lxc/start.c index fe3100a90..f100b9515 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -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\"");