From: Christopher Dykes Date: Tue, 9 Aug 2016 23:47:40 +0000 (-0700) Subject: Allow the time remaining parameter to nanosleep to be null X-Git-Tag: v2016.08.15.00~29 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cc01a8a4915f51a62771f958162a5489af090748;p=folly.git 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 --- 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; }