diff options
Diffstat (limited to 'plugins/check_tcp.c')
-rw-r--r-- | plugins/check_tcp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index a1a14b45..c103612a 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -102,7 +102,6 @@ int | |||
102 | main (int argc, char **argv) | 102 | main (int argc, char **argv) |
103 | { | 103 | { |
104 | int result = STATE_UNKNOWN; | 104 | int result = STATE_UNKNOWN; |
105 | int i; | ||
106 | char *status = NULL; | 105 | char *status = NULL; |
107 | struct timeval tv; | 106 | struct timeval tv; |
108 | struct timeval timeout; | 107 | struct timeval timeout; |
@@ -124,7 +123,7 @@ main (int argc, char **argv) | |||
124 | len = strlen(progname); | 123 | len = strlen(progname); |
125 | if(len > 6 && !memcmp(progname, "check_", 6)) { | 124 | if(len > 6 && !memcmp(progname, "check_", 6)) { |
126 | SERVICE = strdup(progname + 6); | 125 | SERVICE = strdup(progname + 6); |
127 | for(i = 0; i < len - 6; i++) | 126 | for(size_t i = 0; i < len - 6; i++) |
128 | SERVICE[i] = toupper(SERVICE[i]); | 127 | SERVICE[i] = toupper(SERVICE[i]); |
129 | } | 128 | } |
130 | 129 | ||
@@ -275,7 +274,7 @@ main (int argc, char **argv) | |||
275 | printf("Quit string: %s\n", server_quit); | 274 | printf("Quit string: %s\n", server_quit); |
276 | } | 275 | } |
277 | printf("server_expect_count: %d\n", (int)server_expect_count); | 276 | printf("server_expect_count: %d\n", (int)server_expect_count); |
278 | for(i = 0; i < server_expect_count; i++) | 277 | for(size_t i = 0; i < server_expect_count; i++) |
279 | printf("\t%d: %s\n", i, server_expect[i]); | 278 | printf("\t%d: %s\n", i, server_expect[i]); |
280 | } | 279 | } |
281 | 280 | ||
@@ -284,10 +283,11 @@ main (int argc, char **argv) | |||
284 | if (server_expect_count) { | 283 | if (server_expect_count) { |
285 | 284 | ||
286 | /* watch for the expect string */ | 285 | /* watch for the expect string */ |
287 | while ((i = my_recv(buffer, sizeof(buffer))) > 0) { | 286 | size_t received = 0; |
288 | status = realloc(status, len + i + 1); | 287 | while ((received = my_recv(buffer, sizeof(buffer))) > 0) { |
289 | memcpy(&status[len], buffer, i); | 288 | status = realloc(status, len + received + 1); |
290 | len += i; | 289 | memcpy(&status[len], buffer, received); |
290 | len += received; | ||
291 | status[len] = '\0'; | 291 | status[len] = '\0'; |
292 | 292 | ||
293 | /* stop reading if user-forced */ | 293 | /* stop reading if user-forced */ |