diff --git a/contrib/peer-approver/notification-listener.c b/contrib/peer-approver/notification-listener.c index a31c971..faad60f 100644 --- a/contrib/peer-approver/notification-listener.c +++ b/contrib/peer-approver/notification-listener.c @@ -22,6 +22,7 @@ static struct nl_sock *sk = NULL; static char **cb_argv; static int cb_argc; +static bool running_cb = false; static int cleanup_and_exit(int ret) { @@ -32,7 +33,8 @@ static int cleanup_and_exit(int ret) static void signal_handler(int sig) { - cleanup_and_exit(EXIT_SUCCESS); + if (!running_cb) + cleanup_and_exit(EXIT_SUCCESS); } static inline void encode_base64(char dest[static 4], const uint8_t src[static 3]) @@ -127,8 +129,11 @@ static int run_callback(char *ifname, char *pubkey, char *endpoint_ip, bool adva new_argv[cb_argc - 2] = endpoint_ip; new_argv[cb_argc - 1] = (advanced_security ? "on\0" : "off\0"); new_argv[cb_argc] = NULL; - //prerr("Calling ") + + running_cb = true; int ret = execv(cb_argv[1], new_argv); + running_cb = false; + free(new_argv); return ret; }