From 1800efc13806440867b92758d01f0ce97e239e36 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 18 Oct 2013 17:10:03 +0200 Subject: [PATCH] unix: fix non-synchronized access in signal.c Check the return value of uv__signal_lock(); don't mutate the signal watcher tree in the signal handler if we failed to acquire the lock. --- src/unix/signal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/unix/signal.c b/src/unix/signal.c index 22c7783b..aa84ff2f 100644 --- a/src/unix/signal.c +++ b/src/unix/signal.c @@ -141,7 +141,10 @@ static void uv__signal_handler(int signum) { saved_errno = errno; memset(&msg, 0, sizeof msg); - uv__signal_lock(); + if (uv__signal_lock()) { + errno = saved_errno; + return; + } for (handle = uv__signal_first_handle(signum); handle != NULL && handle->signum == signum;