Commit 35e3a0cd by Stéphane Graber

coverity: check return value of fcntl in usernsexec

parent 119126b6
......@@ -69,13 +69,16 @@ static void opentty(const char * tty) {
fd = open(tty, O_RDWR | O_NONBLOCK);
if (fd == -1) {
printf("WARN: could not reopen tty: %s", strerror(errno));
printf("WARN: could not reopen tty: %s\n", strerror(errno));
return;
}
flags = fcntl(fd, F_GETFL);
flags &= ~O_NONBLOCK;
fcntl(fd, F_SETFL, flags);
if (fcntl(fd, F_SETFL, flags) < 0) {
printf("WARN: could not set fd flags: %s\n", strerror(errno));
return;
}
for (i = 0; i < fd; i++)
close(i);
......
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