if check_tcp was called with -e but not -s, it would hang in a call to my_recv. the

fix committed here adds on more piece of logic to the check to see if more data needs
to be read, avoiding the deadlock call.  a better fix would be to not use these "voodoo"
heuristics and instead use poll() or select(), but that's quite a bit more complicated.


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1170 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
M. Sean Finney 2005-05-03 01:52:19 +00:00
parent 1cd64d081d
commit 3e5b9b3d32

View file

@ -322,8 +322,10 @@ main (int argc, char **argv)
while ((i = my_recv ()) > 0) {
buffer[i] = '\0';
asprintf (&status, "%s%s", status, buffer);
if (buffer[i-2] == '\r' && buffer[i-1] == '\n')
break;
if (buffer[i-1] == '\n') {
if (buffer[i-2] == '\r' || i < MAXBUF-1)
break;
}
if (maxbytes>0 && strlen(status) >= (unsigned)maxbytes)
break;
}