From: Michal Sojka Date: Tue, 12 Sep 2017 11:12:31 +0000 (+0200) Subject: uloop: Fix race condition in SIGCHLD handling X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=commitdiff_plain;h=7a1057604ed2ad83434ed3be03728065b14a5e9c;hp=7a1057604ed2ad83434ed3be03728065b14a5e9c;ds=sidebyside uloop: Fix race condition in SIGCHLD handling When uloop_process_add() is called outside of uloop_run(), i.e. not from a callback (which is the case of at least utrace and ujail), child events can be missed. The reason is that when SIGCHILD handler is installed in uloop_run(), after the uloop_process_add() is called, then an initial signal could be missed. Commit 4e3a47a ("uloop: use a waker for notifying sigchld and loop cancel events", 2016-06-09) solved a similar problem and introduced uloop_init() but forgot to move a call to uloop_setup_signals() there. This is what this commit does. Now, uloop_process_add() can be called any time after uloop_init() without missing any event. Signed-off-by: Michal Sojka Acked-by: Yousong Zhou ---