aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-10-07 12:09:51 -0500
committerRob Landley <rob@landley.net>2018-10-07 12:09:51 -0500
commit2b789c342a8a1bc79eaf753b7f8aace247020f44 (patch)
tree284f2a972f22cc058b159080099fd185f21179ac
parent1c336a9e7dec14c1bef0f34c949720bbe14756a8 (diff)
downloadtoybox-2b789c342a8a1bc79eaf753b7f8aace247020f44.tar.gz
Fix build break on x32 target.
-rw-r--r--toys/other/timeout.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/toys/other/timeout.c b/toys/other/timeout.c
index 9b93466a..b62d696e 100644
--- a/toys/other/timeout.c
+++ b/toys/other/timeout.c
@@ -52,13 +52,22 @@ static void handler(int i)
}
}
+// timeval inexplicably makes up a new type for microseconds, despite timespec's
+// nanoseconds field (needing to store 1000* the range) using "long". Bravo.
+void xparsetimeval(char *s, struct timeval *tv)
+{
+ long ll;
+
+ tv->tv_sec = xparsetime(s, 1000000, &ll);
+ tv->tv_usec = ll;
+}
+
void timeout_main(void)
{
// Parse early to get any errors out of the way.
- TT.itv.it_value.tv_sec = xparsetime(*toys.optargs, 1000000, &TT.itv.it_value.tv_usec);
+ xparsetimeval(*toys.optargs, &TT.itv.it_value);
+ if (TT.k_timeout) xparsetimeval(TT.k_timeout, &TT.ktv);
- if (TT.k_timeout)
- TT.ktv.tv_sec = xparsetime(TT.k_timeout, 1000000, &TT.ktv.tv_usec);
TT.nextsig = SIGTERM;
if (TT.s_signal && -1 == (TT.nextsig = sig_to_num(TT.s_signal)))
error_exit("bad -s: '%s'", TT.s_signal);