summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2017-12-07 16:02:11 +0300
committerDmitry Kozlov <xeb@mail.ru>2017-12-07 16:02:11 +0300
commitabc8e981b69732b7a23ab36b437811f7b4b9bd8a (patch)
tree39699eb1470c49bf1d08ec19b2380f7bbd21c3d5
parent28cafaac477170d9dabf970d33da0b45bafebe49 (diff)
downloadaccel-ppp-abc8e981b69732b7a23ab36b437811f7b4b9bd8a.tar.gz
accel-ppp-abc8e981b69732b7a23ab36b437811f7b4b9bd8a.zip
pppd_compat: fixed bug caused fork queue to stall
-rw-r--r--accel-pppd/extra/pppd_compat.c3
-rw-r--r--accel-pppd/extra/sigchld.c7
-rw-r--r--accel-pppd/extra/sigchld.h2
3 files changed, 9 insertions, 3 deletions
diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c
index 0ed88368..c62fabc4 100644
--- a/accel-pppd/extra/pppd_compat.c
+++ b/accel-pppd/extra/pppd_compat.c
@@ -385,7 +385,8 @@ static void ev_ses_finished(struct ap_session *ses)
log_ppp_warn("pppd_compat: ip-up is not yet finished, killing it ...\n");
kill(pd->ip_up_hnd.pid, SIGKILL);
pthread_mutex_unlock(&pd->ip_up_hnd.lock);
- sigchld_unregister_handler(&pd->ip_up_hnd);
+ if (sigchld_unregister_handler(&pd->ip_up_hnd))
+ fork_queue_wakeup();
} else
pthread_mutex_unlock(&pd->ip_up_hnd.lock);
}
diff --git a/accel-pppd/extra/sigchld.c b/accel-pppd/extra/sigchld.c
index cfce2cd2..d03a7ff0 100644
--- a/accel-pppd/extra/sigchld.c
+++ b/accel-pppd/extra/sigchld.c
@@ -82,16 +82,21 @@ void __export sigchld_register_handler(struct sigchld_handler_t *h)
pthread_mutex_unlock(&handlers_lock);
}
-void __export sigchld_unregister_handler(struct sigchld_handler_t *h)
+int __export sigchld_unregister_handler(struct sigchld_handler_t *h)
{
+ int r = 0;
+
pthread_mutex_lock(&handlers_lock);
pthread_mutex_lock(&h->lock);
if (h->pid) {
list_del(&h->entry);
h->pid = 0;
+ r = 1;
}
pthread_mutex_unlock(&h->lock);
pthread_mutex_unlock(&handlers_lock);
+
+ return r;
}
void __export sigchld_lock()
diff --git a/accel-pppd/extra/sigchld.h b/accel-pppd/extra/sigchld.h
index 27d1adf4..f06adab7 100644
--- a/accel-pppd/extra/sigchld.h
+++ b/accel-pppd/extra/sigchld.h
@@ -13,7 +13,7 @@ struct sigchld_handler_t
};
void sigchld_register_handler(struct sigchld_handler_t *);
-void sigchld_unregister_handler(struct sigchld_handler_t *);
+int sigchld_unregister_handler(struct sigchld_handler_t *);
void sigchld_lock();
void sigchld_unlock();