From 07f9c438f31de7a280e43c4196a32d200ad41fbe Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:10:55 +0200 Subject: Fixes for -Wsign-compare --- plugins/check_by_ssh.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'plugins/check_by_ssh.c') diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 1f5f72d4..2a23b397 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c @@ -68,7 +68,6 @@ main (int argc, char **argv) char *status_text; int cresult; int result = STATE_UNKNOWN; - int i; time_t local_time; FILE *fp = NULL; output chld_out, chld_err; @@ -96,7 +95,7 @@ main (int argc, char **argv) /* run the command */ if (verbose) { printf ("Command: %s\n", commargv[0]); - for (i=1; i skip_stderr) { + if(chld_err.lines > (size_t)skip_stderr) { printf (_("Remote command execution failed: %s\n"), chld_err.line[skip_stderr]); if ( warn_on_stderr ) @@ -134,8 +133,8 @@ main (int argc, char **argv) /* this is simple if we're not supposed to be passive. * Wrap up quickly and keep the tricks below */ if(!passive) { - if (chld_out.lines > skip_stdout) - for (i = skip_stdout; i < chld_out.lines; i++) + if (chld_out.lines > (size_t)skip_stdout) + for (size_t i = skip_stdout; i < chld_out.lines; i++) puts (chld_out.line[i]); else printf (_("%s - check_by_ssh: Remote command '%s' returned status %d\n"), @@ -156,7 +155,7 @@ main (int argc, char **argv) local_time = time (NULL); commands = 0; - for(i = skip_stdout; i < chld_out.lines; i++) { + for(size_t i = skip_stdout; i < chld_out.lines; i++) { status_text = chld_out.line[i++]; if (i == chld_out.lines || strstr (chld_out.line[i], "STATUS CODE: ") == NULL) die (STATE_UNKNOWN, _("%s: Error parsing output\n"), progname); -- cgit v1.2.3-74-g34f1