Sorry, got it wrong the first time ... The problem was that the
read buffer was not cleared the second time. If we don't do this
we get a completly mess. And second, if read returns one byte,
we need to test this case for beeing '\n' to break out of the loop.
--- check_tcp.c 2004-12-30 01:41:40.000000000 +0100
+++ check_tcp.c 2006-10-31 12:07:53.000000000 +0100
@@ -312,10 +312,13 @@
while ((i = my_recv ()) > 0) {
buffer[i] = '\0';
asprintf (&status, "%s%s", status, buffer);
+ if (i == 1 && buffer[0] == '\n')
+ break;
if (buffer[i-2] == '\r' && buffer[i-1] == '\n')
break;
if (maxbytes>0 && strlen(status) >= (unsigned)maxbytes)
break;
+ memset (buffer, '\0', MAXBUF);
}
/* return a CRITICAL status if we couldn't read any data */
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]