Author :
cheloha
Date :
2024-01-07 19:44:28
Hash :2e686a7f Message :libc, librthread: _twait: subtraction is not comparison
Compare the current time with the absolute timeout before computing
the relative timeout to avoid arithmetic overflow. Fixes a bug where
large negative absolute timeouts are subtracted into large positive
relative timeouts and incorrectly cause the caller to block.
While here, use timespeccmp(3) and timespecsub(3) to simplify the
code.
Thread: https://marc.info/?l=openbsd-tech&m=169945962503129&w=2