Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not pass invalid file descriptor to FD_ISSET()
Currently there is a race condition between the main thread and the workers threads. The main thread sets nslcd_serversocket to -1 without ensuring that all worker threads are stopped, giving them the window of opportunity to pass the now invalid fd to FD_ISSET(). This results in SIGBUS on musl libc. Closing the file descriptor is enough. I've also dropped close() in exithandler() to prevent misleading logs. The OS will close the socket anyway.
- Loading branch information