diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2019-01-18 14:31:01 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2019-01-18 14:31:01 +0100 |
commit | 397526dee858e4b43b0e4ecca470a1df92f09d5d (patch) | |
tree | a661f1492ae571bca712ab014bd654a2f419d54a /winsup/cygwin/signal.cc | |
parent | 7f983079d4a62e3f906a97bf091908a1dad29bb6 (diff) | |
download | newlib-397526dee858e4b43b0e4ecca470a1df92f09d5d.zip newlib-397526dee858e4b43b0e4ecca470a1df92f09d5d.tar.gz newlib-397526dee858e4b43b0e4ecca470a1df92f09d5d.tar.bz2 |
Cygwin: clock.h: add valid_timespec() to check timespec for validity
Use throughout, drop local timespec_bad() in timer.cc.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/signal.cc')
-rw-r--r-- | winsup/cygwin/signal.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 5759cc4..fdde260 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -69,7 +69,7 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp, __try { - if (rqtp->tv_sec < 0 || rqtp->tv_nsec < 0 || rqtp->tv_nsec >= NSPERSEC) + if (!valid_timespec (*rqtp)) return EINVAL; } __except (NO_ERROR) @@ -654,8 +654,7 @@ sigtimedwait (const sigset_t *set, siginfo_t *info, const timespec *timeout) if (timeout) { - if (timeout->tv_sec < 0 - || timeout->tv_nsec < 0 || timeout->tv_nsec > NSPERSEC) + if (!valid_timespec (*timeout)) { set_errno (EINVAL); return -1; |