From: Steven Barth Date: Wed, 15 May 2013 11:06:29 +0000 (+0200) Subject: script: fix delay call handling X-Git-Tag: debian/1.1+git20160131-1~148 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=odhcp6c.git;a=commitdiff_plain;h=dbf89816bd12d727dc7b006406f619ff3d2da382;ds=sidebyside script: fix delay call handling --- diff --git a/src/script.c b/src/script.c index 9d88daf..bda9749 100644 --- a/src/script.c +++ b/src/script.c @@ -41,6 +41,7 @@ static const int8_t hexvals[] = { static char *argv[4] = {NULL, NULL, NULL, NULL}; static volatile char *delayed_call = NULL; +static bool dont_delay = false; int script_init(const char *path, const char *ifname) @@ -212,7 +213,9 @@ static void script_call_delayed(int signal __attribute__((unused))) void script_delay_call(const char *status, int timeout) { - if (!delayed_call) { + if (dont_delay) { + script_call(status); + } else if (!delayed_call) { delayed_call = strdup(status); signal(SIGALRM, script_call_delayed); alarm(timeout); @@ -226,8 +229,10 @@ void script_call(const char *status) size_t sip_ip_len, sip_fqdn_len, aftr_name_len; odhcp6c_expire(); - if (delayed_call) + if (delayed_call) { alarm(0); + dont_delay = true; + } struct in6_addr *dns = odhcp6c_get_state(STATE_DNS, &dns_len); uint8_t *search = odhcp6c_get_state(STATE_SEARCH, &search_len);