mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Reporting warnings if kill/waitpid fail in communication system. Also
replace bzero with memset(). Patches from Bill Parker.
This commit is contained in:
parent
177c014cb7
commit
90fc5c97e5
4 changed files with 38 additions and 8 deletions
|
@ -545,8 +545,11 @@ RemoteSerializer::~RemoteSerializer()
|
|||
{
|
||||
if ( child_pid )
|
||||
{
|
||||
kill(child_pid, SIGKILL);
|
||||
waitpid(child_pid, 0, 0);
|
||||
if ( kill(child_pid, SIGKILL) < 0 )
|
||||
reporter->Warning("warning: cannot kill child (pid %d), %s", child_pid, strerror(errno));
|
||||
|
||||
else if ( waitpid(child_pid, 0, 0) < 0 )
|
||||
reporter->Warning("warning: error encountered during waitpid(%d), %s", child_pid, strerror(errno));
|
||||
}
|
||||
|
||||
delete io;
|
||||
|
@ -3161,7 +3164,10 @@ void RemoteSerializer::FatalError(const char* msg)
|
|||
reporter->Error("%s", msg);
|
||||
|
||||
closed = true;
|
||||
kill(child_pid, SIGQUIT);
|
||||
|
||||
if ( kill(child_pid, SIGQUIT) < 0 )
|
||||
reporter->Warning("warning: cannot kill child pid %d, %s", child_pid, strerror(errno));
|
||||
|
||||
child_pid = 0;
|
||||
using_communication = false;
|
||||
io->Clear();
|
||||
|
@ -3971,7 +3977,7 @@ bool SocketComm::Connect(Peer* peer)
|
|||
{
|
||||
int status;
|
||||
addrinfo hints, *res, *res0;
|
||||
bzero(&hints, sizeof(hints));
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
@ -4103,7 +4109,7 @@ bool SocketComm::Listen()
|
|||
{
|
||||
int status, on = 1;
|
||||
addrinfo hints, *res, *res0;
|
||||
bzero(&hints, sizeof(hints));
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
|
||||
IPAddr listen_ip(listen_if);
|
||||
|
||||
|
@ -4368,7 +4374,8 @@ void SocketComm::Kill()
|
|||
|
||||
CloseListenFDs();
|
||||
|
||||
kill(getpid(), SIGTERM);
|
||||
if ( kill(getpid(), SIGTERM) < 0 )
|
||||
Log(fmt("warning: cannot kill SocketComm pid %d, %s", getpid(), strerror(errno)));
|
||||
|
||||
while ( 1 )
|
||||
; // loop until killed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue