From: Stéphane Graber Date: Wed, 12 Feb 2014 21:08:08 +0000 (-0500) Subject: coverity: check return value of fcntl in usernsexec X-Git-Tag: lxc-1.0.0.rc1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35e3a0cdf7884010f1a2ea806960003337798d6a;p=thirdparty%2Flxc.git coverity: check return value of fcntl in usernsexec Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/lxc_usernsexec.c b/src/lxc/lxc_usernsexec.c index b82bcf8da..e40fa53df 100644 --- a/src/lxc/lxc_usernsexec.c +++ b/src/lxc/lxc_usernsexec.c @@ -69,13 +69,16 @@ static void opentty(const char * tty) { fd = open(tty, O_RDWR | O_NONBLOCK); if (fd == -1) { - printf("WARN: could not reopen tty: %s", strerror(errno)); + printf("WARN: could not reopen tty: %s\n", strerror(errno)); return; } flags = fcntl(fd, F_GETFL); flags &= ~O_NONBLOCK; - fcntl(fd, F_SETFL, flags); + if (fcntl(fd, F_SETFL, flags) < 0) { + printf("WARN: could not set fd flags: %s\n", strerror(errno)); + return; + } for (i = 0; i < fd; i++) close(i);