From: Christian Brauner Date: Thu, 12 Jul 2018 15:52:09 +0000 (+0200) Subject: coverity: #1437935 X-Git-Tag: lxc-3.1.0~210^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0ee564f646780b7aefc997f6fe04ebbad703bb6;p=thirdparty%2Flxc.git coverity: #1437935 Unchecked return value Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cmd/lxc_usernsexec.c b/src/lxc/cmd/lxc_usernsexec.c index cfe5db26c..1426eed5d 100644 --- a/src/lxc/cmd/lxc_usernsexec.c +++ b/src/lxc/cmd/lxc_usernsexec.c @@ -75,14 +75,15 @@ static void usage(const char *name) printf(" calling user permission to use the mapped ranges\n"); } -static void opentty(const char * tty, int which) { +static void opentty(const char *tty, int which) +{ int fd, flags; if (tty[0] == '\0') return; fd = open(tty, O_RDWR | O_NONBLOCK); - if (fd == -1) { + if (fd < 0) { printf("WARN: could not reopen tty: %s\n", strerror(errno)); return; } @@ -97,7 +98,7 @@ static void opentty(const char * tty, int which) { close(which); if (fd != which) { - dup2(fd, which); + (void)dup2(fd, which); close(fd); } }