[nagiosplug] check_tcp: Don't close connection too early

Nagios Plugin Development nagios-plugins at users.sourceforge.net
Tue Sep 10 12:20:13 CEST 2013


    Module: nagiosplug
    Branch: master
    Commit: cfb50add532c1b5c80ea8214340b0a908a7fab65
    Author: juliopedreira <julio.pedreira at gmail.com>
 Committer: Holger Weiss <holger at zedat.fu-berlin.de>
      Date: Tue Sep 10 10:11:12 2013 +0200
       URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=cfb50ad

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!

---

 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 ce966c3..b024821 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;
 		}





More information about the Commits mailing list