[PATCH] Cygwin: clock_settime: fail with EINVAL if tv_nsec is negative

Christian Franke Christian.Franke@t-online.de
Tue Apr 29 08:31:41 GMT 2025


Jon Turney wrote:
> On 28/04/2025 16:43, Christian Franke wrote:
>> A followup to:
>> https://sourceware.org/pipermail/cygwin-patches/2025q2/013678.html
>
> Thanks!
>
> The SUS page for clock_settime() contains the following text:
>
>> [EINVAL]
>>     The tp argument specified a nanosecond value less than zero or 
>> greater than or equal to 1000 million. 
>
> ... so if we're going to validate tv_nsec, it seems that's the range 
> to use
>
>

Yes. The patch only checks the lower bound because the upper bound is 
already correctly checked later in settimeofday().

-- 
Regards,
Christian



More information about the Cygwin-patches mailing list