mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Check spawn_func() return value
If we don't, we can wind up with a wedged cpuworker, and write to it
for ages and ages.
Found by skruffy. This was a bug in 2dda97e8fd
, a.k.a. svn
revision 402. It's been there since we have been using cpuworkers.
This commit is contained in:
parent
3511549651
commit
85b46d57bc
6
changes/bug4345
Normal file
6
changes/bug4345
Normal file
@ -0,0 +1,6 @@
|
||||
o Minor bugfixes:
|
||||
- Check return code on spawn_func() in cpuworker code, so that we don't
|
||||
think we've spawned a nonworking cpuworker and write junk to it
|
||||
forever. Fix for bug 4345; bugfix on all released Tor versions.
|
||||
Found by "skruffy".
|
||||
|
@ -528,7 +528,12 @@ spawn_cpuworker(void)
|
||||
tor_assert(SOCKET_OK(fdarray[1]));
|
||||
|
||||
fd = fdarray[0];
|
||||
spawn_func(cpuworker_main, (void*)fdarray);
|
||||
if (spawn_func(cpuworker_main, (void*)fdarray) < 0) {
|
||||
tor_close_socket(fdarray[0]);
|
||||
tor_close_socket(fdarray[1]);
|
||||
tor_free(fdarray);
|
||||
return -1;
|
||||
}
|
||||
log_debug(LD_OR,"just spawned a cpu worker.");
|
||||
#ifndef TOR_IS_MULTITHREADED
|
||||
tor_close_socket(fdarray[1]); /* don't need the worker's side of the pipe */
|
||||
|
Loading…
Reference in New Issue
Block a user