Skip to content

Commit

Permalink
don't close std* fd if opentty fails
Browse files Browse the repository at this point in the history
We didn't do it before, and it makes testcases fail.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
hallyn committed Oct 30, 2015
1 parent 9e5a2a0 commit 407fef4
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/lxc/lxc_usernsexec.c
Expand Up @@ -83,15 +83,13 @@ static void opentty(const char * tty, int which) {
fd = open(tty, O_RDWR | O_NONBLOCK);
if (fd == -1) {
printf("WARN: could not reopen tty: %s\n", strerror(errno));
close(which);
return;
}

flags = fcntl(fd, F_GETFL);
flags &= ~O_NONBLOCK;
if (fcntl(fd, F_SETFL, flags) < 0) {
printf("WARN: could not set fd flags: %s\n", strerror(errno));
close(which);
return;
}

Expand Down

0 comments on commit 407fef4

Please sign in to comment.