Commit b7841fc
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.1 parent ed4041c commit b7841fc
1 file changed
+0
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | 224 | | |
232 | 225 | | |
233 | 226 | | |
| |||
918 | 911 | | |
919 | 912 | | |
920 | 913 | | |
921 | | - | |
922 | 914 | | |
923 | 915 | | |
924 | 916 | | |
| |||
0 commit comments