summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2014-12-08 16:44:08 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2014-12-08 16:44:08 +0000
commit87edd769f6ae18ca17d51b8ca9cfd43a98266696 (patch)
treee8c0f283872c1eb0af1b213144e6feaa2046f588 /src
parent2b6241ac532510c585f26afa64009508cbd81033 (diff)
downloads6-87edd769f6ae18ca17d51b8ca9cfd43a98266696.tar.xz
Fix s6-notifywhenup
Diffstat (limited to 'src')
-rw-r--r--src/daemontools-extras/s6-notifywhenup.c9
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]) ;