mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 06:15:37 +00:00
Linux select() may return ENOMEM if there is a kernel resource
shortage. Older Solaris select() may return EIO instead of EBADF when the tty goes away. If we get an unhandled select() failure, kill the child and exit cleanly.
This commit is contained in:
@@ -1015,9 +1015,10 @@ exec_monitor(struct command_details *details, int backchannel)
|
||||
if (n <= 0) {
|
||||
if (n == 0)
|
||||
goto done;
|
||||
if (errno == EINTR)
|
||||
if (errno == EINTR || errno == ENOMEM)
|
||||
continue;
|
||||
error(1, "monitor: %s", _("select failed"));
|
||||
warning("monitor: %s", _("select failed"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (FD_ISSET(signal_pipe[0], fdsr)) {
|
||||
@@ -1152,11 +1153,11 @@ flush_output(void)
|
||||
if (nready <= 0) {
|
||||
if (nready == 0)
|
||||
break; /* all I/O flushed */
|
||||
if (errno == EINTR)
|
||||
if (errno == EINTR || errno == ENOMEM)
|
||||
continue;
|
||||
error(1, _("select failed"));
|
||||
warning(_("select failed"));
|
||||
}
|
||||
if (perform_io(fdsr, fdsw, NULL) != 0)
|
||||
if (perform_io(fdsr, fdsw, NULL) != 0 || nready == -1)
|
||||
break;
|
||||
}
|
||||
efree(fdsr);
|
||||
|
Reference in New Issue
Block a user