Support default base in got_exit, got_break, loopexit, loopbreak, loopcontinue
This commit is contained in:
@@ -725,6 +725,12 @@ void
|
|||||||
sudo_ev_loopexit_v1(struct sudo_event_base *base)
|
sudo_ev_loopexit_v1(struct sudo_event_base *base)
|
||||||
{
|
{
|
||||||
debug_decl(sudo_ev_loopexit, SUDO_DEBUG_EVENT)
|
debug_decl(sudo_ev_loopexit, SUDO_DEBUG_EVENT)
|
||||||
|
|
||||||
|
if (base == NULL) {
|
||||||
|
if ((base = default_base) == NULL)
|
||||||
|
debug_return;
|
||||||
|
}
|
||||||
|
|
||||||
/* SUDO_EVBASE_LOOPBREAK trumps SUDO_EVBASE_LOOPEXIT */
|
/* SUDO_EVBASE_LOOPBREAK trumps SUDO_EVBASE_LOOPEXIT */
|
||||||
if (!ISSET(base->flags, SUDO_EVBASE_LOOPBREAK)) {
|
if (!ISSET(base->flags, SUDO_EVBASE_LOOPBREAK)) {
|
||||||
/* SUDO_EVBASE_LOOPEXIT trumps SUDO_EVBASE_LOOPCONT */
|
/* SUDO_EVBASE_LOOPEXIT trumps SUDO_EVBASE_LOOPCONT */
|
||||||
@@ -738,6 +744,12 @@ void
|
|||||||
sudo_ev_loopbreak_v1(struct sudo_event_base *base)
|
sudo_ev_loopbreak_v1(struct sudo_event_base *base)
|
||||||
{
|
{
|
||||||
debug_decl(sudo_ev_loopbreak, SUDO_DEBUG_EVENT)
|
debug_decl(sudo_ev_loopbreak, SUDO_DEBUG_EVENT)
|
||||||
|
|
||||||
|
if (base == NULL) {
|
||||||
|
if ((base = default_base) == NULL)
|
||||||
|
debug_return;
|
||||||
|
}
|
||||||
|
|
||||||
/* SUDO_EVBASE_LOOPBREAK trumps SUDO_EVBASE_LOOP{CONT,EXIT,ONCE}. */
|
/* SUDO_EVBASE_LOOPBREAK trumps SUDO_EVBASE_LOOP{CONT,EXIT,ONCE}. */
|
||||||
CLR(base->flags, (SUDO_EVBASE_LOOPCONT|SUDO_EVBASE_LOOPEXIT|SUDO_EVBASE_LOOPONCE));
|
CLR(base->flags, (SUDO_EVBASE_LOOPCONT|SUDO_EVBASE_LOOPEXIT|SUDO_EVBASE_LOOPONCE));
|
||||||
SET(base->flags, SUDO_EVBASE_LOOPBREAK);
|
SET(base->flags, SUDO_EVBASE_LOOPBREAK);
|
||||||
@@ -748,6 +760,12 @@ void
|
|||||||
sudo_ev_loopcontinue_v1(struct sudo_event_base *base)
|
sudo_ev_loopcontinue_v1(struct sudo_event_base *base)
|
||||||
{
|
{
|
||||||
debug_decl(sudo_ev_loopcontinue, SUDO_DEBUG_EVENT)
|
debug_decl(sudo_ev_loopcontinue, SUDO_DEBUG_EVENT)
|
||||||
|
|
||||||
|
if (base == NULL) {
|
||||||
|
if ((base = default_base) == NULL)
|
||||||
|
debug_return;
|
||||||
|
}
|
||||||
|
|
||||||
/* SUDO_EVBASE_LOOP{BREAK,EXIT} trumps SUDO_EVBASE_LOOPCONT */
|
/* SUDO_EVBASE_LOOP{BREAK,EXIT} trumps SUDO_EVBASE_LOOPCONT */
|
||||||
if (!ISSET(base->flags, SUDO_EVBASE_LOOPONCE|SUDO_EVBASE_LOOPBREAK)) {
|
if (!ISSET(base->flags, SUDO_EVBASE_LOOPONCE|SUDO_EVBASE_LOOPBREAK)) {
|
||||||
SET(base->flags, SUDO_EVBASE_LOOPCONT);
|
SET(base->flags, SUDO_EVBASE_LOOPCONT);
|
||||||
@@ -759,6 +777,11 @@ bool
|
|||||||
sudo_ev_got_exit_v1(struct sudo_event_base *base)
|
sudo_ev_got_exit_v1(struct sudo_event_base *base)
|
||||||
{
|
{
|
||||||
debug_decl(sudo_ev_got_exit, SUDO_DEBUG_EVENT)
|
debug_decl(sudo_ev_got_exit, SUDO_DEBUG_EVENT)
|
||||||
|
|
||||||
|
if (base == NULL) {
|
||||||
|
if ((base = default_base) == NULL)
|
||||||
|
debug_return_bool(false);
|
||||||
|
}
|
||||||
debug_return_bool(ISSET(base->flags, SUDO_EVBASE_GOT_EXIT));
|
debug_return_bool(ISSET(base->flags, SUDO_EVBASE_GOT_EXIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -766,6 +789,11 @@ bool
|
|||||||
sudo_ev_got_break_v1(struct sudo_event_base *base)
|
sudo_ev_got_break_v1(struct sudo_event_base *base)
|
||||||
{
|
{
|
||||||
debug_decl(sudo_ev_got_break, SUDO_DEBUG_EVENT)
|
debug_decl(sudo_ev_got_break, SUDO_DEBUG_EVENT)
|
||||||
|
|
||||||
|
if (base == NULL) {
|
||||||
|
if ((base = default_base) == NULL)
|
||||||
|
debug_return_bool(false);
|
||||||
|
}
|
||||||
debug_return_bool(ISSET(base->flags, SUDO_EVBASE_GOT_BREAK));
|
debug_return_bool(ISSET(base->flags, SUDO_EVBASE_GOT_BREAK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user