coverity: #1437935

Unchecked return value Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 00c72a93
...@@ -75,14 +75,15 @@ static void usage(const char *name) ...@@ -75,14 +75,15 @@ static void usage(const char *name)
printf(" calling user permission to use the mapped ranges\n"); 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; int fd, flags;
if (tty[0] == '\0') if (tty[0] == '\0')
return; return;
fd = open(tty, O_RDWR | O_NONBLOCK); fd = open(tty, O_RDWR | O_NONBLOCK);
if (fd == -1) { if (fd < 0) {
printf("WARN: could not reopen tty: %s\n", strerror(errno)); printf("WARN: could not reopen tty: %s\n", strerror(errno));
return; return;
} }
...@@ -97,7 +98,7 @@ static void opentty(const char * tty, int which) { ...@@ -97,7 +98,7 @@ static void opentty(const char * tty, int which) {
close(which); close(which);
if (fd != which) { if (fd != which) {
dup2(fd, which); (void)dup2(fd, which);
close(fd); close(fd);
} }
} }
......
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