diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2014-12-08 16:44:08 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2014-12-08 16:44:08 +0000 |
commit | 87edd769f6ae18ca17d51b8ca9cfd43a98266696 (patch) | |
tree | e8c0f283872c1eb0af1b213144e6feaa2046f588 /src/daemontools-extras | |
parent | 2b6241ac532510c585f26afa64009508cbd81033 (diff) | |
download | s6-87edd769f6ae18ca17d51b8ca9cfd43a98266696.tar.xz |
Fix s6-notifywhenup
Diffstat (limited to 'src/daemontools-extras')
-rw-r--r-- | src/daemontools-extras/s6-notifywhenup.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/daemontools-extras/s6-notifywhenup.c b/src/daemontools-extras/s6-notifywhenup.c index a4be329..5c151ed 100644 --- a/src/daemontools-extras/s6-notifywhenup.c +++ b/src/daemontools-extras/s6-notifywhenup.c @@ -22,16 +22,17 @@ static int run_child (int fd, char const *fifodir, unsigned int timeout) int haswritten = 0 ; register int r = 0 ; if (!tain_now_g()) strerr_diefu1sys(111, "tain_now") ; - tain_from_millisecs(&deadline, timeout) ; + if (timeout) tain_from_millisecs(&deadline, timeout) ; + else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; while (!r) { - register int r = iopause_g(&x, 1, &deadline) ; + r = iopause_g(&x, 1, &deadline) ; if (r < 0) strerr_diefu1sys(111, "iopause") ; if (!r) return 99 ; while (r > 0) { - r = sanitize_read(fd_read(fd, dummy, 4096)) ; + r = sanitize_read(fd_read(fd, dummy, 4096)) ; /* talk to the hand */ if (r > 0) haswritten = 1 ; } } @@ -72,7 +73,7 @@ int main (int argc, char const *const *argv, char const *const *envp) if (pipe(p) < 0) strerr_diefu1sys(111, "pipe") ; pid = df ? doublefork() : fork() ; if (pid < 0) strerr_diefu1sys(111, df ? "doublefork" : "fork") ; - else if (pid) + else if (!pid) { PROG = "s6-notifywhenup (child)" ; fd_close(p[1]) ; |