]> git.proxmox.com Git - mirror_lxc.git/commitdiff
start: don't unconditionally open("/dev/null")
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 9 Jul 2018 12:28:57 +0000 (14:28 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 9 Jul 2018 23:20:29 +0000 (01:20 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index fe3100a902cc1535bded8a4d2c181c501bf1bab1..f100b9515a0fb739e3947007a5c146edaaa1ea98 100644 (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\"");