]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
utils: set_stdfds() 1690/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 10 Jul 2017 09:46:54 +0000 (11:46 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 10 Jul 2017 09:46:54 +0000 (11:46 +0200)
non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/utils.c

index f4fa0ab06abbac51e2c2a5f6641f3c69851feb2e..5b61cba00fbea3b27c8bcb39a0392f9c4ee7414f 100644 (file)
@@ -1822,14 +1822,21 @@ int open_devnull(void)
 
 int set_stdfds(int fd)
 {
+       int ret;
+
        if (fd < 0)
                return -1;
 
-       if (dup2(fd, 0) < 0)
+       ret = dup2(fd, STDIN_FILENO);
+       if (ret < 0)
                return -1;
-       if (dup2(fd, 1) < 0)
+
+       ret = dup2(fd, STDOUT_FILENO);
+       if (ret < 0)
                return -1;
-       if (dup2(fd, 2) < 0)
+
+       ret = dup2(fd, STDERR_FILENO);
+       if (ret < 0)
                return -1;
 
        return 0;