summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-09-17 11:09:00 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-09-17 11:09:00 +0000
commit0ca7c064eb23d30187a1870176ab07f96c7cf3ed (patch)
treea79abb936a249660696ac6657ae02567c352b758 /src
parent1c0891effd8cc41d8c9453ef4f2a39f00c49ad9d (diff)
downloads6-portable-utils-0ca7c064eb23d30187a1870176ab07f96c7cf3ed.tar.xz
- fix interpretation of 0 timeout in s6-maximumtimev2.0.5.2
- rc for 2.0.5.2
Diffstat (limited to 'src')
-rw-r--r--src/skaembutils/s6-maximumtime.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/skaembutils/s6-maximumtime.c b/src/skaembutils/s6-maximumtime.c
index 571914f..b5c8eab 100644
--- a/src/skaembutils/s6-maximumtime.c
+++ b/src/skaembutils/s6-maximumtime.c
@@ -19,11 +19,11 @@
int main (int argc, char const *const *argv, char const *const *envp)
{
- unsigned int timeout ;
- tain_t stamp, deadline ;
+ tain_t deadline ;
iopause_fd x[1] = { { .fd = -1, .events = IOPAUSE_READ, .revents = 0 } } ;
pid_t pid = 0 ;
int tosend = SIGTERM ;
+ unsigned int timeout ;
PROG = "s6-maximumtime" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
@@ -50,9 +50,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
if ((argc < 2) || !uint0_scan(argv[0], &timeout)) strerr_dieusage(100, USAGE) ;
- if (!timeout) timeout = 1 ;
- if (!tain_from_millisecs(&deadline, timeout))
- strerr_diefu1sys(111, "taia_from_millisecs") ;
+ if (timeout) tain_from_millisecs(&deadline, timeout) ;
+ else deadline = tain_infinite_relative ;
x[0].fd = selfpipe_init() ;
if (x[0].fd < 0) strerr_diefu1sys(111, "selfpipe_init") ;
@@ -60,13 +59,13 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (selfpipe_trap(SIGCHLD) < 0) strerr_diefu1sys(111, "selfpipe_trap") ;
pid = child_spawn0(argv[1], argv+1, envp) ;
- if (!pid) strerr_diefu2sys(111, "spawn ", argv[1]) ;
- tain_now(&stamp) ;
- tain_add(&deadline, &deadline, &stamp) ;
+ if (!pid) strerr_diefu2sys(111, "spawn ", argv[1]) ;
+ tain_now_g() ;
+ tain_add_g(&deadline, &deadline) ;
for (;;)
{
- int r = iopause_stamp(x, 1, &deadline, &stamp) ;
+ int r = iopause_g(x, 1, &deadline) ;
if (r < 0) strerr_diefu1sys(111, "iopause") ;
if (!r) break ;
if (x[0].revents & IOPAUSE_READ)