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.
This commit is contained in:
Ben Noordhuis 2013-10-18 17:10:03 +02:00
parent 38df93cfed
commit 1800efc138

View File

@ -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;