aboutsummaryrefslogtreecommitdiff
path: root/src/rc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-22 19:33:42 +0000
committerRoy Marples <roy@marples.name>2007-10-22 19:33:42 +0000
commit9dddb43eb49d07d8c1b87e11c8d259fd41a34ae4 (patch)
treebb4d9e3908468f9a4347c19842afd7da62850525 /src/rc.c
parent6b0c28039d051af85f009cb2cbc4c77a3d93bdb0 (diff)
Wait for plugins to finish before moving on.
Diffstat (limited to 'src/rc.c')
-rw-r--r--src/rc.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/rc.c b/src/rc.c
index 4906d6a1..e61bdd57 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -629,21 +629,6 @@ static void remove_pid (pid_t pid)
}
}
-static int wait_pid (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;
- }
-
- return (retval);
-}
-
static void handle_signal (int sig)
{
int serrno = errno;
@@ -1223,7 +1208,7 @@ int main (int argc, char **argv)
if (going_down) {
pid_t pid = rc_service_stop (service);
if (pid > 0 && ! rc_env_bool ("RC_PARALLEL"))
- wait_pid (pid);
+ rc_waitpid (pid);
continue;
}
@@ -1289,7 +1274,7 @@ int main (int argc, char **argv)
if (! found) {
pid_t pid = rc_service_stop (service);
if (pid > 0 && ! rc_env_bool ("RC_PARALLEL"))
- wait_pid (pid);
+ rc_waitpid (pid);
}
}
@@ -1385,7 +1370,7 @@ interactive_option:
add_pid (pid);
if (! rc_env_bool ("RC_PARALLEL")) {
- wait_pid (pid);
+ rc_waitpid (pid);
remove_pid (pid);
}
}