conf: use fd_cloexec()

parent b7b18fc5
...@@ -984,12 +984,12 @@ int lxc_allocate_ttys(struct lxc_conf *conf) ...@@ -984,12 +984,12 @@ int lxc_allocate_ttys(struct lxc_conf *conf)
tty->name, tty->master, tty->slave); tty->name, tty->master, tty->slave);
/* Prevent leaking the file descriptors to the container */ /* 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) if (ret < 0)
SYSWARN("Failed to set FD_CLOEXEC flag on master fd %d of " SYSWARN("Failed to set FD_CLOEXEC flag on master fd %d of "
"tty device \"%s\"", tty->master, tty->name); "tty device \"%s\"", tty->master, tty->name);
ret = fcntl(tty->slave, F_SETFD, FD_CLOEXEC); ret = fd_cloexec(tty->slave, true);
if (ret < 0) if (ret < 0)
SYSWARN("Failed to set FD_CLOEXEC flag on slave fd %d of " SYSWARN("Failed to set FD_CLOEXEC flag on slave fd %d of "
"tty device \"%s\"", tty->slave, tty->name); "tty device \"%s\"", tty->slave, tty->name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment