From: Christian Brauner Date: Thu, 12 Jul 2018 15:52:09 +0000 (+0200) Subject: coverity: #1437935 X-Git-Tag: lxc-2.0.10~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0127c98a2d2daacb713ec8d1238790724caeb34;p=thirdparty%2Flxc.git coverity: #1437935 Unchecked return value Signed-off-by: Christian Brauner --- diff --git a/src/lxc/tools/lxc_usernsexec.c b/src/lxc/tools/lxc_usernsexec.c index 316eaafcd..f3ae38f32 100644 --- a/src/lxc/tools/lxc_usernsexec.c +++ b/src/lxc/tools/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); } }