[Nagiosplug-checkins] CVS: nagiosplug/plugins check_tcp.c,1.2,1.3

Karl DeBisschop kdebisschop at users.sourceforge.net
Wed Oct 16 23:10:50 CEST 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv31517/plugins

Modified Files:
	check_tcp.c 
Log Message:
using asprintf

Index: check_tcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** check_tcp.c	14 Sep 2002 02:27:45 -0000	1.2
--- check_tcp.c	17 Oct 2002 06:09:06 -0000	1.3
***************
*** 240,252 ****
  	if (server_send || server_expect_count > 0) {
  
  		/* watch for the expect string */
  #ifdef HAVE_SSL
  		if (use_ssl && SSL_read (ssl, buffer, MAX_INPUT_BUFFER - 1)>=0)
! 			status = strscat(status,buffer);
  		else
  #endif
  			{
  				if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) >= 0)
! 					status = strscat (status, buffer);
  			}
  		strip (status);
--- 240,254 ----
  	if (server_send || server_expect_count > 0) {
  
+ 		asprintf (&status, "");
+ 
  		/* watch for the expect string */
  #ifdef HAVE_SSL
  		if (use_ssl && SSL_read (ssl, buffer, MAX_INPUT_BUFFER - 1)>=0)
! 			asprintf (&status, "%s%s", status, buffer);
  		else
  #endif
  			{
  				if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) >= 0)
! 					asprintf (&status, "%s%s", status, buffer);
  			}
  		strip (status);
***************
*** 261,265 ****
  		if (server_expect_count > 0) {
  			for (i = 0;; i++) {
! 				printf ("%d %d\n", i, server_expect_count);
  				if (i >= server_expect_count)
  					terminate (STATE_WARNING, "Invalid response from host\n");
--- 263,268 ----
  		if (server_expect_count > 0) {
  			for (i = 0;; i++) {
! 				if (verbose)
! 					printf ("%d %d\n", i, server_expect_count);
  				if (i >= server_expect_count)
  					terminate (STATE_WARNING, "Invalid response from host\n");
***************
*** 426,430 ****
  			server_send = optarg;
  			break;
! 		case 'e':
  			EXPECT = NULL;
  			if (server_expect_count == 0)
--- 429,433 ----
  			server_send = optarg;
  			break;
! 		case 'e': /* expect string (may be repeated) */
  			EXPECT = NULL;
  			if (server_expect_count == 0)





More information about the Commits mailing list