diff --git a/src/syslogd.c b/src/syslogd.c index bb48adf..6f40456 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -2645,6 +2645,7 @@ static void init(void) } else { for (size_t i = 0; i < pe->pe_socknum; i++) socket_close(pe->pe_sock[i]); + pe->pe_socknum = 0; if (SecureMode < 2) create_inet_socket(pe); diff --git a/test/remote.sh b/test/remote.sh index 735bd7c..8301bb0 100755 --- a/test/remote.sh +++ b/test/remote.sh @@ -1,6 +1,10 @@ #!/bin/sh # Verify that the sending to a remote IP:PORT works, note not receiving, # there's a test fwd.sh that verifies that. +# +# Also, instead of "sleep 3" after starting thsark, below, we take the +# opportunity to perform a regression test of SIGHUP:ing syslogd. +# # shellcheck disable=SC1090 set -x @@ -27,9 +31,14 @@ tshark -Qni lo -w "${CAP}" port 514 2>/dev/null & TPID="$!" echo "$TPID" >> "$DIR/PIDs" -# Wait for tshark to start up properly -sleep 3 +# While Waiting for tshark to start up properly we take the opportunity +# to verify syslogd survives a few SIGHUP's. The pe_sock[] has max 16 +# elements, which should get closed and refilled on SIGHUP. +for i in $(seq 1 20); do + reload +done +# Now send the message and see if we sent it ... logger ${MSG} # Wait for any OS delays, in particular on Travis