From c1c9abbfcafe8e55d86dfe13aed6874ad194d761 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 29 Dec 2023 00:45:14 +0100 Subject: Change iritating NULL assignment diff --git a/plugins/popen.c b/plugins/popen.c index 036bc60..54e63bc 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -105,7 +105,7 @@ spopen (const char *cmdstring) #endif env[0] = strdup("LC_ALL=C"); - env[1] = '\0'; + env[1] = NULL; /* if no command was passed, return with no error */ if (cmdstring == NULL) diff --git a/plugins/runcmd.c b/plugins/runcmd.c index 32fd6b9..ed49bb9 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c @@ -115,7 +115,7 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) if(!np_pids) NP_RUNCMD_INIT; env[0] = strdup("LC_ALL=C"); - env[1] = '\0'; + env[1] = NULL; /* make copy of command string so strtok() doesn't silently modify it */ /* (the calling program may want to access it later) */ -- cgit v0.10-9-g596f From ad864430b083d713803725337cf954fdd73f2abd Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 29 Dec 2023 00:45:54 +0100 Subject: check_http: Remove self assignment of a variable and add some comments diff --git a/plugins/check_http.c b/plugins/check_http.c index 110f118..425ce86 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -472,9 +472,8 @@ bool process_arguments (int argc, char **argv) http_method = strdup (optarg); char *tmp; if ((tmp = strstr(http_method, ":")) != NULL) { - tmp[0] = '\0'; - http_method = http_method; - http_method_proxy = ++tmp; + tmp[0] = '\0'; // set the ":" in the middle to 0 + http_method_proxy = ++tmp; // this points to the second part } break; case 'd': /* string or substring */ -- cgit v0.10-9-g596f From 5275f81e38c756c57a695939df541e96b3386a5f Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 29 Dec 2023 00:47:29 +0100 Subject: check_snmp: Remove unused variable diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 7ee9d0c..295aa9b 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -691,7 +691,6 @@ process_arguments (int argc, char **argv) { char *ptr; int c = 1; - int ii = 0; size_t j = 0, jj = 0; int option = 0; @@ -848,7 +847,6 @@ process_arguments (int argc, char **argv) numoids = j; if (c == 'E' || c == 'e') { jj++; - ii++; while (j+1 >= eval_size) { eval_size += OID_COUNT_STEP; eval_method = realloc(eval_method, eval_size * sizeof(*eval_method)); @@ -875,7 +873,6 @@ process_arguments (int argc, char **argv) memset(eval_method + eval_size - OID_COUNT_STEP, 0, 8); } eval_method[jj++] = CRIT_STRING; - ii++; break; case 'R': /* regex */ cflags = REG_ICASE; @@ -896,7 +893,6 @@ process_arguments (int argc, char **argv) memset(eval_method + eval_size - OID_COUNT_STEP, 0, 8); } eval_method[jj++] = CRIT_REGEX; - ii++; break; /* Format */ -- cgit v0.10-9-g596f From 8fe3fc78299dbd5fc3612853a502a99fbaf35451 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 29 Dec 2023 00:59:58 +0100 Subject: check_dhcp: Make implicit conversion explicit to dismiss warning diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 6b07df5..4b8f5e2 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -497,7 +497,7 @@ int send_dhcp_discover(int sock){ memcpy(&discover_packet.options[opts],&requested_address,sizeof(requested_address)); opts += sizeof(requested_address); } - discover_packet.options[opts++]=DHCP_OPTION_END; + discover_packet.options[opts++]= (char)DHCP_OPTION_END; /* unicast fields */ if(unicast) -- cgit v0.10-9-g596f