[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#6037) errno in signal handlers

Full_Name: Hallvard B Furuseth
Version: HEAD, RE24
Submission from: (NULL) (
Submitted by: hallvard

Signal handlers slapd/daemon.c:slap_sig_shutdown()/slap_sig_wake() need
to save/restore errno, since they call functions that can modify errno.

And/or possibly they need sock_errno() - sock_errset() from ac/socket.h,
since they use tcp_write()?  I don't know if that's safe inside signal
handlers, or if Windows itself saves/restores this code around signal

slapd/main.c:wait4child() can loop forever after EINTR, since it checks
for errno even when the waitpid returns 0.  I don't know if there is
a good reason it does that.  Some of the commits have my name on them
but I think I copied it from elsewhere.

Anyway, I'm doing the minimal changes now: save/restore errno, and
set errno=0 in each loop iteration instead of before the loop.
Anyone with better ideas can take it from there.