diff options
author | juliopedreira <julio.pedreira@gmail.com> | 2013-09-10 10:11:12 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-10 12:16:46 +0200 |
commit | cfb50add532c1b5c80ea8214340b0a908a7fab65 (patch) | |
tree | 2a678c2bab011fb4e54718c353d0e7b7e672914e | |
parent | 5bfca4b34d15ef40239ed6074b9ff9c061022946 (diff) | |
download | monitoring-plugins-cfb50add532c1b5c80ea8214340b0a908a7fab65.tar.gz |
check_tcp: Don't close connection too early
Closing the connection because the bytes received are less than the
buffer size assumes that all the bytes will be received in one go. This
is not always true!
-rw-r--r-- | plugins/check_tcp.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index ce966c38..b024821e 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -277,10 +277,7 @@ main (int argc, char **argv) | |||
277 | memcpy(&status[len], buffer, i); | 277 | memcpy(&status[len], buffer, i); |
278 | len += i; | 278 | len += i; |
279 | 279 | ||
280 | /* stop reading if user-forced or data-starved */ | 280 | /* stop reading if user-forced */ |
281 | if(i < sizeof(buffer) || (maxbytes && len >= maxbytes)) | ||
282 | break; | ||
283 | |||
284 | if (maxbytes && len >= maxbytes) | 281 | if (maxbytes && len >= maxbytes) |
285 | break; | 282 | break; |
286 | } | 283 | } |