From cc01a8a4915f51a62771f958162a5489af090748 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Tue, 9 Aug 2016 16:47:40 -0700 Subject: [PATCH] Allow the time remaining parameter to nanosleep to be null Summary: Pah! This definitely wasn't causing the lock tests to segfault. Nope, not at all <_>. Reviewed By: yfeldblum Differential Revision: D3691120 fbshipit-source-id: 6601db637f22c7b0bc326907a2a7976f6df7c159 --- folly/portability/Time.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/folly/portability/Time.cpp b/folly/portability/Time.cpp index bf165f41..79c71b7a 100755 --- a/folly/portability/Time.cpp +++ b/folly/portability/Time.cpp @@ -320,8 +320,10 @@ tm* localtime_r(const time_t* t, tm* o) { int nanosleep(const struct timespec* request, struct timespec* remain) { Sleep((DWORD)((request->tv_sec * 1000) + (request->tv_nsec / 1000000))); - remain->tv_nsec = 0; - remain->tv_sec = 0; + if (remain != nullptr) { + remain->tv_nsec = 0; + remain->tv_sec = 0; + } return 0; } -- 2.34.1