Unverified Commit 74370367 by Stéphane Graber Committed by GitHub

Merge pull request #2462 from brauner/2018-07-12/coverity

coverity
parents 99c42eaa a0ee564f
......@@ -908,13 +908,13 @@ static int attach_child_main(struct attach_clone_payload *payload)
* may want to make sure the fds are closed, for example.
*/
if (options->stdin_fd >= 0 && options->stdin_fd != STDIN_FILENO)
dup2(options->stdin_fd, STDIN_FILENO);
(void)dup2(options->stdin_fd, STDIN_FILENO);
if (options->stdout_fd >= 0 && options->stdout_fd != STDOUT_FILENO)
dup2(options->stdout_fd, STDOUT_FILENO);
(void)dup2(options->stdout_fd, STDOUT_FILENO);
if (options->stderr_fd >= 0 && options->stderr_fd != STDERR_FILENO)
dup2(options->stderr_fd, STDERR_FILENO);
(void)dup2(options->stderr_fd, STDERR_FILENO);
/* close the old fds */
if (options->stdin_fd > STDERR_FILENO)
......
......@@ -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);
}
}
......
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