summaryrefslogtreecommitdiff
path: root/runit
diff options
context:
space:
mode:
authorDenys Vlasenko2020-12-29 16:53:11 +0100
committerDenys Vlasenko2020-12-29 16:53:11 +0100
commit77a51a2709de1b646ab493f0bf771d896de6efc2 (patch)
treed0e44b91d8391ca06d4de3f7d5101da76c4f940e /runit
parentc7ef8187688b0e7f92d19b3fed2c4ecffe39a688 (diff)
downloadbusybox-77a51a2709de1b646ab493f0bf771d896de6efc2.zip
busybox-77a51a2709de1b646ab493f0bf771d896de6efc2.tar.gz
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'runit')
-rw-r--r--runit/runsv.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/runit/runsv.c b/runit/runsv.c
index 7e22862..d395d45 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -58,11 +58,19 @@ static void gettimeofday_ns(struct timespec *ts)
#else
static void gettimeofday_ns(struct timespec *ts)
{
- BUILD_BUG_ON(sizeof(struct timeval) != sizeof(struct timespec));
- BUILD_BUG_ON(sizeof(((struct timeval*)ts)->tv_usec) != sizeof(ts->tv_nsec));
- /* Cheat */
- gettimeofday((void*)ts, NULL);
- ts->tv_nsec *= 1000;
+ if (sizeof(struct timeval) == sizeof(struct timespec)
+ && sizeof(((struct timeval*)ts)->tv_usec) == sizeof(ts->tv_nsec)
+ ) {
+ /* Cheat */
+ gettimeofday((void*)ts, NULL);
+ ts->tv_nsec *= 1000;
+ } else {
+ /* For example, musl has "incompatible" layouts */
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ ts->tv_sec = tv.tv_sec;
+ ts->tv_nsec = tv.tv_usec * 1000;
+ }
}
#endif