-/* $OpenBSD: ifstated.c,v 1.48 2017/07/02 15:28:26 benno Exp $ */
+/* $OpenBSD: ifstated.c,v 1.49 2017/07/03 18:45:34 benno Exp $ */
/*
* Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org>
conf->curstate->entered = time(NULL);
conf->nextstate = conf->curstate;
conf->curstate = NULL;
- while (state_change())
+ while (state_change()) {
+ do_action(conf->curstate->init);
do_action(conf->curstate->body);
+ }
}
return (0);
}
if (external == NULL || external->lastexec >= state->entered ||
external->lastexec == 0) {
do_action(state->body);
- while (state_change())
+ while (state_change()) {
+ do_action(conf->curstate->init);
do_action(conf->curstate->body);
+ }
}
}
-/*
- *If a previous action included a state change, process it.
- */
int
state_change(void)
{
conf->curstate->entered = time(NULL);
external_evtimer_setup(conf->curstate, IFSD_EVTIMER_ADD);
adjust_external_expressions(conf->curstate);
- do_action(conf->curstate->init);
return (1);
}
return (0);
close(sock);
}
-/*
- * Clear the config.
- */
void
clear_config(struct ifsd_config *oconf)
{