summaryrefslogtreecommitdiffstats
path: root/plugins/check_by_ssh.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2023-11-01 11:05:50 +0100
committerGitHub <noreply@github.com>2023-11-01 11:05:50 +0100
commit6d08e1c8c96d0327a5b819dc1fbb0d5754f3e2e5 (patch)
tree575867b1d1eef4cd20215f22f9151ebb4a02c93d /plugins/check_by_ssh.c
parent03bde80abbda6fba2225568c3285a2ff2b5445a8 (diff)
parent76d9f25cd0dbe99657baeb6fa139a1831558adae (diff)
downloadmonitoring-plugins-6d08e1c.tar.gz
Merge branch 'master' into fix_check_mailq
Diffstat (limited to 'plugins/check_by_ssh.c')
-rw-r--r--plugins/check_by_ssh.c15
1 files changed, 7 insertions, 8 deletions
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)
68 char *status_text; 68 char *status_text;
69 int cresult; 69 int cresult;
70 int result = STATE_UNKNOWN; 70 int result = STATE_UNKNOWN;
71 int i;
72 time_t local_time; 71 time_t local_time;
73 FILE *fp = NULL; 72 FILE *fp = NULL;
74 output chld_out, chld_err; 73 output chld_out, chld_err;
@@ -96,7 +95,7 @@ main (int argc, char **argv)
96 /* run the command */ 95 /* run the command */
97 if (verbose) { 96 if (verbose) {
98 printf ("Command: %s\n", commargv[0]); 97 printf ("Command: %s\n", commargv[0]);
99 for (i=1; i<commargc; i++) 98 for (int i = 1; i < commargc; i++)
100 printf ("Argument %i: %s\n", i, commargv[i]); 99 printf ("Argument %i: %s\n", i, commargv[i]);
101 } 100 }
102 101
@@ -110,9 +109,9 @@ main (int argc, char **argv)
110 } 109 }
111 110
112 if (verbose) { 111 if (verbose) {
113 for(i = 0; i < chld_out.lines; i++) 112 for(size_t i = 0; i < chld_out.lines; i++)
114 printf("stdout: %s\n", chld_out.line[i]); 113 printf("stdout: %s\n", chld_out.line[i]);
115 for(i = 0; i < chld_err.lines; i++) 114 for(size_t i = 0; i < chld_err.lines; i++)
116 printf("stderr: %s\n", chld_err.line[i]); 115 printf("stderr: %s\n", chld_err.line[i]);
117 } 116 }
118 117
@@ -122,7 +121,7 @@ main (int argc, char **argv)
122 skip_stderr = chld_err.lines; 121 skip_stderr = chld_err.lines;
123 122
124 /* UNKNOWN or worse if (non-skipped) output found on stderr */ 123 /* UNKNOWN or worse if (non-skipped) output found on stderr */
125 if(chld_err.lines > skip_stderr) { 124 if(chld_err.lines > (size_t)skip_stderr) {
126 printf (_("Remote command execution failed: %s\n"), 125 printf (_("Remote command execution failed: %s\n"),
127 chld_err.line[skip_stderr]); 126 chld_err.line[skip_stderr]);
128 if ( warn_on_stderr ) 127 if ( warn_on_stderr )
@@ -134,8 +133,8 @@ main (int argc, char **argv)
134 /* this is simple if we're not supposed to be passive. 133 /* this is simple if we're not supposed to be passive.
135 * Wrap up quickly and keep the tricks below */ 134 * Wrap up quickly and keep the tricks below */
136 if(!passive) { 135 if(!passive) {
137 if (chld_out.lines > skip_stdout) 136 if (chld_out.lines > (size_t)skip_stdout)
138 for (i = skip_stdout; i < chld_out.lines; i++) 137 for (size_t i = skip_stdout; i < chld_out.lines; i++)
139 puts (chld_out.line[i]); 138 puts (chld_out.line[i]);
140 else 139 else
141 printf (_("%s - check_by_ssh: Remote command '%s' returned status %d\n"), 140 printf (_("%s - check_by_ssh: Remote command '%s' returned status %d\n"),
@@ -156,7 +155,7 @@ main (int argc, char **argv)
156 155
157 local_time = time (NULL); 156 local_time = time (NULL);
158 commands = 0; 157 commands = 0;
159 for(i = skip_stdout; i < chld_out.lines; i++) { 158 for(size_t i = skip_stdout; i < chld_out.lines; i++) {
160 status_text = chld_out.line[i++]; 159 status_text = chld_out.line[i++];
161 if (i == chld_out.lines || strstr (chld_out.line[i], "STATUS CODE: ") == NULL) 160 if (i == chld_out.lines || strstr (chld_out.line[i], "STATUS CODE: ") == NULL)
162 die (STATE_UNKNOWN, _("%s: Error parsing output\n"), progname); 161 die (STATE_UNKNOWN, _("%s: Error parsing output\n"), progname);