diff options
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 a7155d2..102191e 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 | ||