[monitoring-plugins] Fixes for -Wnonnull-compare

RincewindsHat git at monitoring-plugins.org
Tue Sep 19 11:10:12 CEST 2023


 Module: monitoring-plugins
 Branch: master
 Commit: a00c412e7ba1474b32f478daf039d2bdf71f072a
 Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
   Date: Sun Mar 12 14:59:23 2023 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=a00c412

Fixes for -Wnonnull-compare

---

 lib/utils_cmd.c  | 4 ----
 plugins/runcmd.c | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c
index 8b8e570..34fb390 100644
--- a/lib/utils_cmd.c
+++ b/lib/utils_cmd.c
@@ -118,10 +118,6 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr)
 
 	int i = 0;
 
-	/* if no command was passed, return with no error */
-	if (argv == NULL)
-		return -1;
-
 	if (!_cmd_pids)
 		CMD_INIT;
 
diff --git a/plugins/runcmd.c b/plugins/runcmd.c
index 1bd2ca1..ff1987f 100644
--- a/plugins/runcmd.c
+++ b/plugins/runcmd.c
@@ -114,10 +114,6 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr)
 	env[0] = strdup("LC_ALL=C");
 	env[1] = '\0';
 
-	/* if no command was passed, return with no error */
-	if (cmdstring == NULL)
-		return -1;
-
 	/* make copy of command string so strtok() doesn't silently modify it */
 	/* (the calling program may want to access it later) */
 	cmdlen = strlen(cmdstring);



More information about the Commits mailing list