Reporting warnings if kill/waitpid fail in communication system. Also

replace bzero with memset(). Patches from Bill Parker.
This commit is contained in:
Robin Sommer 2012-12-05 15:47:32 -08:00
parent 177c014cb7
commit 90fc5c97e5
4 changed files with 38 additions and 8 deletions

23
CHANGES
View file

@ -1,4 +1,27 @@
2.1-207 | 2012-12-05 15:47:32 -0800
* Reporting warnings if kill/waitpid fail in communication system.
(Bill Parker)
* Replace() bzero with memset(). (Bill Parker)
* Merge remote-tracking branch 'vlad/topic/vladg/http-verbs'
* vlad/topic/vladg/http-verbs:
A test for HTTP methods, including some horribly illegal requests.
Remove hardcoded HTTP verbs from the analyzer (#741)
I added a "bad_HTTP_request" weird for HTTP request lines that don't
have more than a single word.
Closes #741. (Robin Sommer)
* A test for HTTP methods, including some horribly illegal requests. (Vlad Grigorescu)
* Remove hardcoded HTTP verbs from the analyzer (#741) (Vlad Grigorescu)
2.1-203 | 2012-12-05 14:36:56 -0800
* Fix segfault: Synchronization of state between connecting peers

View file

@ -1 +1 @@
2.1-203
2.1-207

@ -1 +1 @@
Subproject commit a8846fc5b004ffe4e3d00e826d0077ba19518192
Subproject commit 5c983a00ce45b2687d0235b67602c98916910412

View file

@ -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