If select() return EBADF in the main event loop, one of the ttys
must have gone away so perform any I/O we can and close the bad fds.
This commit is contained in:
@@ -337,6 +337,10 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
|
|||||||
if (nready == -1) {
|
if (nready == -1) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
|
if (errno == EBADF) {
|
||||||
|
/* One of the ttys must have gone away. */
|
||||||
|
goto do_tty_io;
|
||||||
|
}
|
||||||
error(1, _("select failed"));
|
error(1, _("select failed"));
|
||||||
}
|
}
|
||||||
if (FD_ISSET(sv[0], fdsw)) {
|
if (FD_ISSET(sv[0], fdsw)) {
|
||||||
@@ -403,7 +407,7 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
do_tty_io:
|
||||||
if (perform_io(fdsr, fdsw, cstat) != 0) {
|
if (perform_io(fdsr, fdsw, cstat) != 0) {
|
||||||
/* I/O error, kill child if still alive and finish. */
|
/* I/O error, kill child if still alive and finish. */
|
||||||
sudo_debug_printf(SUDO_DEBUG_ERROR, "I/O error, terminating child");
|
sudo_debug_printf(SUDO_DEBUG_ERROR, "I/O error, terminating child");
|
||||||
|
Reference in New Issue
Block a user