From c263a29b52f4071bc4b84f592a9b80c80460bfcb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 6 Aug 2015 21:28:02 -0700 Subject: [PATCH] os: fix cond timed wait crash on large timeout --- src/os.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/os.cpp b/src/os.cpp index debca48..722bca4 100644 --- a/src/os.cpp +++ b/src/os.cpp @@ -469,8 +469,9 @@ void soundio_os_cond_timed_wait(struct SoundIoOsCond *cond, // this time is relative struct timespec timeout; - timeout.tv_sec = 0; timeout.tv_nsec = (seconds * 1000000000L); + timeout.tv_sec = timeout.tv_nsec / 1000000000L; + timeout.tv_nsec = timeout.tv_nsec % 1000000000L; if (kevent(cond->kq_id, &kev, 1, &out_kev, 1, &timeout) == -1) { if (errno == EINTR)