Fix crash on double pthread_cancel(3) on exit
On OpenBSD 7.4-current, failure to listen on the RTSP socket(s) results the `rtsp_listener_thread` being pthread_cancel(3)'ed twice, once through `rtsp_listen_loop()` and again via atexit(3) handler `exit_rtsp_listener()`: ``` $ nc -4l 5000 & $ nc -6l 5000 & $ shairport-sync -c/dev/null warning: could not establish a service on port 5000 -- program terminating. Is another instance of Shairport Sync running on this device? Segmentation fault (core dumped) ``` ``` Program terminated with signal SIGSEGV, Segmentation fault. 433 if (tib->tib_canceled == 0 && tid != 0 && [Current thread is 1 (process 290061)] ``` `die()` -> `exit(EXIT_FAILURE)` normally in this case, thus forgoing the first cancel and relying on the atexit handler alone. With Mike Brady.
This commit is contained in:
@@ -5694,7 +5694,7 @@ void *rtsp_listen_loop(__attribute((unused)) void *arg) {
|
||||
} while (1);
|
||||
pthread_cleanup_pop(1); // should never happen
|
||||
} else {
|
||||
warn("could not establish a service on port %d -- program terminating. Is another instance of "
|
||||
die("could not establish a service on port %d -- program terminating. Is another instance of "
|
||||
"Shairport Sync running on this device?",
|
||||
config.port);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user