mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 09:57:41 +00:00
Fix non-blocking mode. We only want to exit the event loop when
poll() or select() returns 0 and there are no active events. This fixes a problem on some systems where the last buffer was not being written when the command exited.
This commit is contained in:
parent
a53946b026
commit
4e333c5165
@ -286,6 +286,11 @@ rescan:
|
|||||||
TAILQ_INSERT_TAIL(&base->active, ev, active_entries);
|
TAILQ_INSERT_TAIL(&base->active, ev, active_entries);
|
||||||
SET(ev->flags, SUDO_EVQ_ACTIVE);
|
SET(ev->flags, SUDO_EVQ_ACTIVE);
|
||||||
}
|
}
|
||||||
|
if (ISSET(flags, SUDO_EVLOOP_NONBLOCK)) {
|
||||||
|
/* If nonblocking, return immediately if no active events. */
|
||||||
|
if (TAILQ_EMPTY(&base->active))
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* I/O events active, sudo_ev_scan_impl() already added them. */
|
/* I/O events active, sudo_ev_scan_impl() already added them. */
|
||||||
@ -333,7 +338,7 @@ rescan:
|
|||||||
SET(base->flags, SUDO_EVBASE_GOT_EXIT);
|
SET(base->flags, SUDO_EVBASE_GOT_EXIT);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (flags & (SUDO_EVLOOP_ONCE | SUDO_EVLOOP_NONBLOCK))
|
if (ISSET(flags, SUDO_EVLOOP_ONCE))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user