#include <unistd.h>
#include <net/if.h>
#include <netinet/in.h>
+#include <setjmp.h>
#include <sys/epoll.h>
#include <sys/param.h>
#include <sys/socket.h>
lxc_log_define(lxc_monitord, lxc);
+sigjmp_buf mark;
+
static void lxc_monitord_cleanup(void);
/*
static void lxc_monitord_sig_handler(int sig)
{
- INFO("Caught signal %d.", sig);
- lxc_monitord_cleanup();
- exit(EXIT_SUCCESS);
+ siglongjmp(mark, 1);
}
int main(int argc, char *argv[])
signal(SIGBUS, lxc_monitord_sig_handler);
signal(SIGTERM, lxc_monitord_sig_handler);
+ if (sigsetjmp(mark, 1) != 0)
+ goto on_signal;
+
ret = EXIT_FAILURE;
memset(&mon, 0, sizeof(mon));
mon.lxcpath = lxcpath;
on_error:
exit(ret);
+
+on_signal:
+ lxc_monitord_cleanup();
+ exit(EXIT_SUCCESS);
}