[monitoring-plugins] Fix compiler warnings due to implizit conversion ...

RincewindsHat git at monitoring-plugins.org
Sat Mar 26 15:40:10 CET 2022


 Module: monitoring-plugins
 Branch: check_load-compiler_warnings
 Commit: dd7af2d6b6269a529972c3e473cf8297670a01ce
 Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
   Date: Sat Mar 26 15:28:24 2022 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=dd7af2d

Fix compiler warnings due to implizit conversion and formats

---

 plugins/check_load.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/check_load.c b/plugins/check_load.c
index 0e4de54..dafe8cc 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -101,7 +101,7 @@ get_threshold(char *arg, double *th)
 int
 main (int argc, char **argv)
 {
-	int result;
+	int result = -1;
 	int i;
 	long numcpus;
 
@@ -164,7 +164,7 @@ main (int argc, char **argv)
 	    sscanf (input_buffer, "%*[^l]load averages: %lf, %lf, %lf", &la1, &la5, &la15);
     }
     else {
-		printf (_("could not parse load from uptime %s: %s\n"), PATH_TO_UPTIME, result);
+		printf (_("could not parse load from uptime %s: %d\n"), PATH_TO_UPTIME, result);
 		return STATE_UNKNOWN;
     }
 
@@ -384,8 +384,8 @@ static int print_top_consuming_processes() {
 #ifdef PS_USES_PROCPCPU
 	qsort(chld_out.line + 1, chld_out.lines - 1, sizeof(char*), cmpstringp);
 #endif /* PS_USES_PROCPCPU */
-	int lines_to_show = chld_out.lines < (n_procs_to_show + 1)
-			? chld_out.lines : n_procs_to_show + 1;
+	int lines_to_show = chld_out.lines < (size_t)(n_procs_to_show + 1)
+			? (int)chld_out.lines : n_procs_to_show + 1;
 	for (i = 0; i < lines_to_show; i += 1) {
 		printf("%s\n", chld_out.line[i]);
 	}



More information about the Commits mailing list