aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc-plugin.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-04-26 14:57:39 +0000
committerRoy Marples <roy@marples.name>2008-04-26 14:57:39 +0000
commitb5d829789f6f4fabb02b7e995267f6e906b002ef (patch)
tree23c0e4bda08a2b06719ca2ececdb84de89ff3a8e /src/rc/rc-plugin.c
parent1e3442f95d2acd290e417f9b26e908c98c4a2c36 (diff)
Check we have a list before running depends.
Diffstat (limited to 'src/rc/rc-plugin.c')
-rw-r--r--src/rc/rc-plugin.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/rc/rc-plugin.c b/src/rc/rc-plugin.c
index 230a85a4..8599af6f 100644
--- a/src/rc/rc-plugin.c
+++ b/src/rc/rc-plugin.c
@@ -122,14 +122,15 @@ int rc_waitpid(pid_t pid)
{
int status = 0;
pid_t savedpid = pid;
- int retval = -1;
-
- errno = 0;
- while ((pid = waitpid(savedpid, &status, 0)) > 0) {
- if (pid == savedpid)
- retval = WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE;
- }
-
+ int retval = EXIT_FAILURE;
+
+ do {
+ pid = waitpid(savedpid, &status, 0);
+ if (pid == -1 && errno != EINTR)
+ return EXIT_FAILURE;
+ } while (!WIFEXITED(status) && !WIFSIGNALED(status));
+ if (pid == savedpid)
+ retval = WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE;
return retval;
}