aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-05-07 09:47:07 +0000
committerRoy Marples <roy@marples.name>2008-05-07 09:47:07 +0000
commita854fe6d61257ff3dc6f4d2bc24baa42d80a9067 (patch)
tree1e22c89248dafd93612d5a4ddc959bb9a39e84c8 /src
parent619b0b4f37dbf05f8e30e15b839ed17ab1a21f5b (diff)
Simplify the wait code.
Diffstat (limited to 'src')
-rw-r--r--src/rc/rc-plugin.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/rc/rc-plugin.c b/src/rc/rc-plugin.c
index 55112f4a..92076730 100644
--- a/src/rc/rc-plugin.c
+++ b/src/rc/rc-plugin.c
@@ -121,24 +121,14 @@ void rc_plugin_load(void)
int rc_waitpid(pid_t pid)
{
int status;
- pid_t savedpid = pid;
-
-loop:
- pid = waitpid(savedpid, &status, 0);
- if (pid == -1) {
- /* Our signal hander should take appropriate action. */
- if (errno == EINTR)
- goto loop;
- return EXIT_FAILURE;
- }
-
- if (pid == savedpid) {
- if (WIFEXITED(status))
- return WEXITSTATUS(status);
- return EXIT_FAILURE;
- }
- return EXIT_SUCCESS;
+ while (waitpid(pid, &status, 0) == -1) {
+ if (errno != EINTR) {
+ status = -1;
+ break;
+ }
+ }
+ return status;
}
void rc_plugin_run(RC_HOOK hook, const char *value)