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:
@@ -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. */
|
||||
|
@@ -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__);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user