Browse Source

* bool x 2 -> enum

master
Alex 'AdUser' Z 9 years ago
parent
commit
7663ac055a
  1. 13
      src/main.c

13
src/main.c

@ -31,18 +31,17 @@ struct {
"", "",
}; };
bool run = true; enum { stop = 0, run, reconfig } state = run;
bool rcfg = false;
void sa_term(int signum) { void sa_term(int signum) {
UNUSED(signum); UNUSED(signum);
f2b_log_msg(log_info, "got SIGTERM/SIGINT, exiting"); f2b_log_msg(log_info, "got SIGTERM/SIGINT, exiting");
run = false; state = stop;
} }
void sa_hup(int signum) { void sa_hup(int signum) {
UNUSED(signum); UNUSED(signum);
f2b_log_msg(log_note, "got SIGHUP, reloading config"); f2b_log_msg(log_note, "got SIGHUP, reloading config");
rcfg = true; state = reconfig;
} }
#define SA_REGISTER(SIGNUM, HANDLER) \ #define SA_REGISTER(SIGNUM, HANDLER) \
@ -228,14 +227,14 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
while (run) { while (state) {
for (jail = jails; jail != NULL; jail = jail->next) { for (jail = jails; jail != NULL; jail = jail->next) {
f2b_jail_process(jail); f2b_jail_process(jail);
} }
sleep(1); sleep(1);
if (rcfg) { if (state == reconfig) {
/* TODO */ /* TODO */
rcfg = false; state = run;
} }
} }

Loading…
Cancel
Save