From: Christian Brauner Date: Wed, 4 Jul 2018 12:49:17 +0000 (+0200) Subject: conf: use fd_cloexec() X-Git-Tag: lxc-3.1.0~219^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=615f24ff503b0681cbb02a8156ff1fc05b206664;p=thirdparty%2Flxc.git conf: use fd_cloexec() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 5f060fe18..8ba5fa833 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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);