diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-20 08:16:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-20 08:16:11 +0200 |
| commit | a5ba424f85153b1ddaaf5e5269c82f0f049828d0 (patch) | |
| tree | b9c158930159f2ab1ea2eb45e9e19ccdd0fbb76b /plugins/runcmd.c | |
| parent | a99db0243baa5d208c5d500a9bde86b4619cec92 (diff) | |
| parent | 220455a11e8f1dd3a86ac4725cf0c799c8e3b21b (diff) | |
| download | monitoring-plugins-a5ba424f85153b1ddaaf5e5269c82f0f049828d0.tar.gz | |
Merge branch 'master' into master
Diffstat (limited to 'plugins/runcmd.c')
| -rw-r--r-- | plugins/runcmd.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/plugins/runcmd.c b/plugins/runcmd.c index a7155d27..102191e4 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c | |||
| @@ -44,6 +44,8 @@ | |||
| 44 | # include <sys/wait.h> | 44 | # include <sys/wait.h> |
| 45 | #endif | 45 | #endif |
| 46 | 46 | ||
| 47 | #include "./utils.h" | ||
| 48 | |||
| 47 | /** macros **/ | 49 | /** macros **/ |
| 48 | #ifndef WEXITSTATUS | 50 | #ifndef WEXITSTATUS |
| 49 | # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) | 51 | # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) |
| @@ -114,10 +116,6 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) | |||
| 114 | env[0] = strdup("LC_ALL=C"); | 116 | env[0] = strdup("LC_ALL=C"); |
| 115 | env[1] = '\0'; | 117 | env[1] = '\0'; |
| 116 | 118 | ||
| 117 | /* if no command was passed, return with no error */ | ||
| 118 | if (cmdstring == NULL) | ||
| 119 | return -1; | ||
| 120 | |||
| 121 | /* make copy of command string so strtok() doesn't silently modify it */ | 119 | /* make copy of command string so strtok() doesn't silently modify it */ |
| 122 | /* (the calling program may want to access it later) */ | 120 | /* (the calling program may want to access it later) */ |
| 123 | cmdlen = strlen(cmdstring); | 121 | cmdlen = strlen(cmdstring); |
| @@ -203,7 +201,7 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) | |||
| 203 | } | 201 | } |
| 204 | 202 | ||
| 205 | /* parent picks up execution here */ | 203 | /* parent picks up execution here */ |
| 206 | /* close childs descriptors in our address space */ | 204 | /* close children descriptors in our address space */ |
| 207 | close(pfd[1]); | 205 | close(pfd[1]); |
| 208 | close(pfderr[1]); | 206 | close(pfderr[1]); |
| 209 | 207 | ||
