mirror of
https://github.com/troglobit/libuev.git
synced 2026-11-17 19:31:18 +00:00
Reset watcher descriptor on failed cron and signal init
When uev_cron_init() or uev_signal_init() fails to add the watcher to the event loop, the watcher is left with a descriptor that is closed. A later set or start on it then operates on that descriptor, which by then may belong to something else. Reset it to -1, as the timer and event watchers do. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
3 files changed
+26
No files matched your search
@@ -72,6 +72,7 @@ int uev_signal_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int signo
|
||||
_uev_watcher_stop(w);
|
||||
exit:
|
||||
close(fd);
|
||||
w->fd = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user