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

"Nagios Plugin Development" <[email protected]> Tue, 10 Sep 2013 10:20:13 +0000
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
    Module: nagiosplug
    Branch: master
    Commit: cfb50add532c1b5c80ea8214340b0a908a7fab65
    Author: juliopedreira <[email protected]>
 Committer: Holger Weiss <[email protected]>
      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;
 		}


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk