From aeaa051f3bd2dd74f664eeba87c9f2140e0b178e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 24 Feb 2019 10:12:03 +0100 Subject: [PATCH] Cygwin: POSIX timers: Fix timer values returned for unarmed timer The "optimized" condition to recognize an unarmed timer was plain wrong. Replace it by checking the stored it_value against 0. Signed-off-by: Corinna Vinschen --- winsup/cygwin/posix_timer.cc | 2 +- winsup/cygwin/release/3.0.2 | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/posix_timer.cc b/winsup/cygwin/posix_timer.cc index a76ba0694..0332cab92 100644 --- a/winsup/cygwin/posix_timer.cc +++ b/winsup/cygwin/posix_timer.cc @@ -245,7 +245,7 @@ timer_tracker::gettime (itimerspec *curr_value, bool lock) return -EINVAL; } } - if (!cancel_evt) + if (!time_spec.it_value.tv_sec && !time_spec.it_value.tv_nsec) memset (curr_value, 0, sizeof (*curr_value)); else { diff --git a/winsup/cygwin/release/3.0.2 b/winsup/cygwin/release/3.0.2 index 0f3f4f741..c1a18a903 100644 --- a/winsup/cygwin/release/3.0.2 +++ b/winsup/cygwin/release/3.0.2 @@ -18,3 +18,6 @@ Bug Fixes - Fix and speed up evaluation of group membership in seteuid. Addresses: Local testing. + +- Fix getitimer/timer_gettime values returned for unarmed timer. + Addresses: https://cygwin.com/ml/cygwin/2019-02/msg00395.html