diff options
| author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 02:50:34 +0100 |
|---|---|---|
| committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 02:50:34 +0100 |
| commit | 060bd01d89a6da0a5a7c3c1779c98a2b2c8c0c53 (patch) | |
| tree | 27d5b9f9e0a15d6c12fc5425cd83341fbb8de14e | |
| parent | ba47cca3ef026209868da044741554cbb6c2bb3b (diff) | |
| download | monitoring-plugins-060bd01d89a6da0a5a7c3c1779c98a2b2c8c0c53.tar.gz | |
check_by_ssh: linter fixes
| -rw-r--r-- | plugins/check_by_ssh.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 598e0463..905b2393 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
| @@ -39,9 +39,9 @@ const char *email = "devel@monitoring-plugins.org"; | |||
| 39 | # define NP_MAXARGS 1024 | 39 | # define NP_MAXARGS 1024 |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
| 42 | static int process_arguments(int, char **); | 42 | static int process_arguments(int /*argc*/, char ** /*argv*/); |
| 43 | static int validate_arguments(void); | 43 | static int validate_arguments(void); |
| 44 | static void comm_append(const char *); | 44 | static void comm_append(const char * /*str*/); |
| 45 | static void print_help(void); | 45 | static void print_help(void); |
| 46 | void print_usage(void); | 46 | void print_usage(void); |
| 47 | 47 | ||
| @@ -67,8 +67,9 @@ int main(int argc, char **argv) { | |||
| 67 | int cresult; | 67 | int cresult; |
| 68 | int result = STATE_UNKNOWN; | 68 | int result = STATE_UNKNOWN; |
| 69 | time_t local_time; | 69 | time_t local_time; |
| 70 | FILE *fp = NULL; | 70 | FILE *file_pointer = NULL; |
| 71 | output chld_out, chld_err; | 71 | output chld_out; |
| 72 | output chld_err; | ||
| 72 | 73 | ||
| 73 | remotecmd = ""; | 74 | remotecmd = ""; |
| 74 | comm_append(SSH_COMMAND); | 75 | comm_append(SSH_COMMAND); |
| @@ -122,8 +123,7 @@ int main(int argc, char **argv) { | |||
| 122 | printf(_("Remote command execution failed: %s\n"), chld_err.line[skip_stderr]); | 123 | printf(_("Remote command execution failed: %s\n"), chld_err.line[skip_stderr]); |
| 123 | if (warn_on_stderr) | 124 | if (warn_on_stderr) |
| 124 | return max_state_alt(result, STATE_WARNING); | 125 | return max_state_alt(result, STATE_WARNING); |
| 125 | else | 126 | return max_state_alt(result, STATE_UNKNOWN); |
| 126 | return max_state_alt(result, STATE_UNKNOWN); | ||
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | /* this is simple if we're not supposed to be passive. | 129 | /* this is simple if we're not supposed to be passive. |
| @@ -142,7 +142,7 @@ int main(int argc, char **argv) { | |||
| 142 | */ | 142 | */ |
| 143 | 143 | ||
| 144 | /* process output */ | 144 | /* process output */ |
| 145 | if (!(fp = fopen(outputfile, "a"))) { | 145 | if (!(file_pointer = fopen(outputfile, "a"))) { |
| 146 | printf(_("SSH WARNING: could not open %s\n"), outputfile); | 146 | printf(_("SSH WARNING: could not open %s\n"), outputfile); |
| 147 | exit(STATE_UNKNOWN); | 147 | exit(STATE_UNKNOWN); |
| 148 | } | 148 | } |
| @@ -155,8 +155,8 @@ int main(int argc, char **argv) { | |||
| 155 | die(STATE_UNKNOWN, _("%s: Error parsing output\n"), progname); | 155 | die(STATE_UNKNOWN, _("%s: Error parsing output\n"), progname); |
| 156 | 156 | ||
| 157 | if (service[commands] && status_text && sscanf(chld_out.line[i], "STATUS CODE: %d", &cresult) == 1) { | 157 | if (service[commands] && status_text && sscanf(chld_out.line[i], "STATUS CODE: %d", &cresult) == 1) { |
| 158 | fprintf(fp, "[%d] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n", (int)local_time, host_shortname, service[commands++], cresult, | 158 | fprintf(file_pointer, "[%d] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n", (int)local_time, host_shortname, service[commands++], |
| 159 | status_text); | 159 | cresult, status_text); |
| 160 | } | 160 | } |
| 161 | } | 161 | } |
| 162 | 162 | ||
| @@ -167,7 +167,8 @@ int main(int argc, char **argv) { | |||
| 167 | /* process command-line arguments */ | 167 | /* process command-line arguments */ |
| 168 | int process_arguments(int argc, char **argv) { | 168 | int process_arguments(int argc, char **argv) { |
| 169 | int c; | 169 | int c; |
| 170 | char *p1, *p2; | 170 | char *p1; |
| 171 | char *p2; | ||
| 171 | 172 | ||
| 172 | int option = 0; | 173 | int option = 0; |
| 173 | static struct option longopts[] = {{"version", no_argument, 0, 'V'}, | 174 | static struct option longopts[] = {{"version", no_argument, 0, 'V'}, |
