]> git.proxmox.com Git - mirror_lxc.git/commitdiff
conf: use fd_cloexec()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 4 Jul 2018 12:49:17 +0000 (14:49 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 4 Jul 2018 16:21:35 +0000 (18:21 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index 5f060fe18c08da2ec09721dffe54a52250fa72ed..8ba5fa8339006a423421ef21f206a64396d902fb 100644 (file)
@@ -984,12 +984,12 @@ int lxc_allocate_ttys(struct lxc_conf *conf)
                      tty->name, tty->master, tty->slave);
 
                /* Prevent leaking the file descriptors to the container */
-               ret = fcntl(tty->master, F_SETFD, FD_CLOEXEC);
+               ret = fd_cloexec(tty->master, true);
                if (ret < 0)
                        SYSWARN("Failed to set FD_CLOEXEC flag on master fd %d of "
                                "tty device \"%s\"", tty->master, tty->name);
 
-               ret = fcntl(tty->slave, F_SETFD, FD_CLOEXEC);
+               ret = fd_cloexec(tty->slave, true);
                if (ret < 0)
                        SYSWARN("Failed to set FD_CLOEXEC flag on slave fd %d of "
                                "tty device \"%s\"", tty->slave, tty->name);