summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1da8bf7)
raw | patch | inline | side by side (parent: 1da8bf7)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 30 Oct 2002 18:47:48 +0000 (18:47 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 30 Oct 2002 18:47:48 +0000 (18:47 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@168 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_tcp.c | patch | blob | history |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index f463a776fa1666b59b2126df796565b92e6128c7..e3fac22e103a49daa48ba0212529e6d8d9281b62 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
*****************************************************************************/
#define PROGRAM check_tcp
+#define REVISION "$Revision$"
#define DESCRIPTION "Check a TCP port"
#define AUTHOR "Ethan Galstad"
#define EMAIL "nagios@nagios.org"
int result;
int i;
char buffer[MAX_INPUT_BUFFER] = "";
- char *status = NULL;
+ char *status = "";
char *output = NULL;
char *ptr = NULL;
struct timeval tv;
return STATE_CRITICAL;
if (server_send != NULL) { /* Something to send? */
- snprintf (buffer, MAX_INPUT_BUFFER - 1, "%s\r\n", server_send);
- buffer[MAX_INPUT_BUFFER - 1] = 0;
+ asprintf (&server_send, "%s\r\n", server_send);
#ifdef HAVE_SSL
if (use_ssl)
- SSL_write(ssl,buffer,strlen(buffer));
+ SSL_write(ssl, server_send, strlen (server_send));
else
#endif
- send (sd, buffer, strlen (buffer), 0);
+ send (sd, server_send, strlen (server_send), 0);
}
if (delay > 0) {
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)
SERVICE,
state_text (result), elapsed_time, server_port);
- if (status)
+ if (strlen (status))
printf (" [%s]", status);
printf ("|time=%7.3f\n", elapsed_time);