aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_tcp.c
diff options
context:
space:
mode:
authorGravatar juliopedreira <julio.pedreira@gmail.com> 2013-09-10 10:11:12 +0200
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2013-09-10 12:16:46 +0200
commitcfb50add532c1b5c80ea8214340b0a908a7fab65 (patch)
tree2a678c2bab011fb4e54718c353d0e7b7e672914e /plugins/check_tcp.c
parent5bfca4b34d15ef40239ed6074b9ff9c061022946 (diff)
downloadmonitoring-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!
Diffstat (limited to 'plugins/check_tcp.c')
-rw-r--r--plugins/check_tcp.c5
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)
memcpy(&status[len], buffer, i);
len += i;
- /* stop reading if user-forced or data-starved */
- if(i < sizeof(buffer) || (maxbytes && len >= maxbytes))
- break;
-
+ /* stop reading if user-forced */
if (maxbytes && len >= maxbytes)
break;
}