aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2002-10-17 06:09:06 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2002-10-17 06:09:06 +0000
commit57351c2f6dafa37d797d2cbad8792cb70ba08177 (patch)
treef2ff4d040ea70525f29e370df06b33794cacb757 /plugins
parentdbaa9dd823cc8c9d43b81f1669e255d492e52572 (diff)
downloadmonitoring-plugins-57351c2f6dafa37d797d2cbad8792cb70ba08177.tar.gz
using asprintf
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@135 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_tcp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index c537729f..140915ab 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -239,15 +239,17 @@ main (int argc, char **argv)
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)
- status = strscat(status,buffer);
+ asprintf (&status, "%s%s", status, buffer);
else
#endif
{
if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) >= 0)
- status = strscat (status, buffer);
+ asprintf (&status, "%s%s", status, buffer);
}
strip (status);
@@ -260,7 +262,8 @@ main (int argc, char **argv)
if (server_expect_count > 0) {
for (i = 0;; i++) {
- printf ("%d %d\n", i, server_expect_count);
+ if (verbose)
+ printf ("%d %d\n", i, server_expect_count);
if (i >= server_expect_count)
terminate (STATE_WARNING, "Invalid response from host\n");
if (strstr (status, server_expect[i]))
@@ -425,7 +428,7 @@ process_arguments (int argc, char **argv)
case 's':
server_send = optarg;
break;
- case 'e':
+ case 'e': /* expect string (may be repeated) */
EXPECT = NULL;
if (server_expect_count == 0)
server_expect = malloc (++server_expect_count);