diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-01-13 12:13:56 (GMT) |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-01-13 12:13:56 (GMT) |
commit | de5650f28e4e43a7264913953f95a75d8afe23f0 (patch) | |
tree | abdebc01760bc6b0fabfe43a7aed08c6ab55e765 | |
parent | be20f98d02ad60637e0092de3d4b48407fa1543f (diff) | |
download | monitoring-plugins-de5650f28e4e43a7264913953f95a75d8afe23f0.tar.gz |
change exit status to be POSIX compliant
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@237 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins/popen.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/popen.c b/plugins/popen.c index d056904..d4151e6 100644 --- a/plugins/popen.c +++ b/plugins/popen.c | |||
@@ -203,24 +203,24 @@ spclose (FILE * fp) | |||
203 | pid_t pid; | 203 | pid_t pid; |
204 | 204 | ||
205 | if (childpid == NULL) | 205 | if (childpid == NULL) |
206 | return (-1); /* popen() has never been called */ | 206 | return (1); /* popen() has never been called */ |
207 | 207 | ||
208 | fd = fileno (fp); | 208 | fd = fileno (fp); |
209 | if ((pid = childpid[fd]) == 0) | 209 | if ((pid = childpid[fd]) == 0) |
210 | return (-1); /* fp wasn't opened by popen() */ | 210 | return (1); /* fp wasn't opened by popen() */ |
211 | 211 | ||
212 | childpid[fd] = 0; | 212 | childpid[fd] = 0; |
213 | if (fclose (fp) == EOF) | 213 | if (fclose (fp) == EOF) |
214 | return (-1); | 214 | return (1); |
215 | 215 | ||
216 | while (waitpid (pid, &stat, 0) < 0) | 216 | while (waitpid (pid, &stat, 0) < 0) |
217 | if (errno != EINTR) | 217 | if (errno != EINTR) |
218 | return (-1); /* error other than EINTR from waitpid() */ | 218 | return (1); /* error other than EINTR from waitpid() */ |
219 | 219 | ||
220 | if (WIFEXITED (stat)) | 220 | if (WIFEXITED (stat)) |
221 | return (WEXITSTATUS (stat)); /* return child's termination status */ | 221 | return (WEXITSTATUS (stat)); /* return child's termination status */ |
222 | 222 | ||
223 | return (STATE_UNKNOWN); | 223 | return (1); |
224 | } | 224 | } |
225 | 225 | ||
226 | #ifdef OPEN_MAX | 226 | #ifdef OPEN_MAX |