diff options
| author | Roy Marples <roy@marples.name> | 2008-05-07 09:39:17 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-05-07 09:39:17 +0000 |
| commit | c3799faefb6200a29d7e875ec70418b523de152b (patch) | |
| tree | 38faa75db3ca2aae8baa36ec1159b3053317734a /configure.c | |
| parent | d7698d1c90290c6d8e2e9b76ff4ab3801326abb6 (diff) | |
| download | dhcpcd-c3799faefb6200a29d7e875ec70418b523de152b.tar.xz | |
dhcpcd doesn't really care about script exist status or if it was signalled, so save a few more bytes.
Diffstat (limited to 'configure.c')
| -rw-r--r-- | configure.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/configure.c b/configure.c index 5c1e50a2..1551f874 100644 --- a/configure.c +++ b/configure.c @@ -52,7 +52,6 @@ exec_script(const char *script, const char *iface, const char *reason, char *const argv[2] = { (char *)script, NULL }; int ret = 0; pid_t pid; - pid_t wpid; int status = 0; sigset_t full; sigset_t old; @@ -100,19 +99,15 @@ exec_script(const char *script, const char *iface, const char *reason, sigprocmask(SIG_SETMASK, &old, NULL); /* Wait for the script to finish */ - do { - wpid = waitpid(pid, &status, 0); - if (wpid < 1) + while (waitpid(pid, &status, 0) == -1) { + if (errno != EINTR) { logger(LOG_ERR, "waitpid: %s", strerror(errno)); - } while (!WIFEXITED(status) && !WIFSIGNALED(status)); + status = -1; + break; + } + } - if (WIFSIGNALED(status)) - logger(LOG_ERR, "script signaled"); - if (WIFEXITED(status)) - ret = WEXITSTATUS(status); - else - ret = -1; - return ret; + return status; } static struct rt * |
