Handle EAGAIN like we do ENOMEM from poll() and select().

On some systems, poll() and select() can return EAGAIN instead
of ENOMEM if there is a kernel resource shortage.  In this case
we just re-enter the event loop and retry.
This commit is contained in:
Todd C. Miller
2020-05-04 11:23:35 -06:00
parent a212ee64e3
commit 0460008c5b
3 changed files with 3 additions and 3 deletions

View File

@@ -661,7 +661,7 @@ rescan:
nready = sudo_ev_scan_impl(base, flags);
switch (nready) {
case -1:
if (errno == ENOMEM)
if (errno == ENOMEM || errno == EAGAIN)
continue;
if (errno == EINTR) {
/* Interrupted by signal, check for sigevents. */

View File

@@ -211,7 +211,7 @@ sudo_ev_scan_impl(struct sudo_event_base *base, int flags)
/* Error: EINTR (signal) or EINVAL (nfds > RLIMIT_NOFILE) */
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO,
"sudo_ev_poll");
debug_return_int(-1);
break;
case 0:
/* Front end will activate timeout events. */
sudo_debug_printf(SUDO_DEBUG_INFO, "%s: timeout", __func__);

View File

@@ -234,7 +234,7 @@ sudo_ev_scan_impl(struct sudo_event_base *base, int flags)
switch (nready) {
case -1:
/* Error or interrupted by signal. */
debug_return_int(-1);
break;
case 0:
/* Front end will activate timeout events. */
break;