Commit 5f73f449 by Serge Hallyn Committed by Stéphane Graber

don't close std* fd if opentty fails

We didn't do it before, and it makes testcases fail. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent e1ff1a15
...@@ -83,7 +83,6 @@ static void opentty(const char * tty, int which) { ...@@ -83,7 +83,6 @@ static void opentty(const char * tty, int which) {
fd = open(tty, O_RDWR | O_NONBLOCK); fd = open(tty, O_RDWR | O_NONBLOCK);
if (fd == -1) { if (fd == -1) {
printf("WARN: could not reopen tty: %s\n", strerror(errno)); printf("WARN: could not reopen tty: %s\n", strerror(errno));
close(which);
return; return;
} }
...@@ -91,7 +90,6 @@ static void opentty(const char * tty, int which) { ...@@ -91,7 +90,6 @@ static void opentty(const char * tty, int which) {
flags &= ~O_NONBLOCK; flags &= ~O_NONBLOCK;
if (fcntl(fd, F_SETFL, flags) < 0) { if (fcntl(fd, F_SETFL, flags) < 0) {
printf("WARN: could not set fd flags: %s\n", strerror(errno)); printf("WARN: could not set fd flags: %s\n", strerror(errno));
close(which);
return; return;
} }
......
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