[hurd,commited] hurd: Make setitimer clear interval on value being 0

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.cvs,gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
posix says value being 0 means disabling a timer, regardless of the
interval, so we should clear the interval in that case, so a further
setitimer call does not see a non-zero interval.
---
 sysdeps/mach/hurd/setitimer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
index 265576e00e..d0bca89157 100644
--- a/sysdeps/mach/hurd/setitimer.c
+++ b/sysdeps/mach/hurd/setitimer.c
@@ -271,7 +271,10 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old)
     }
 
   /* Load the new itimer value.  */
-  _hurd_itimerval = newval;
+  if ((newval.it_value.tv_sec | newval.it_value.tv_usec) != 0)
+    _hurd_itimerval = newval;
+  else
+    _hurd_itimerval = (struct itimerval) { };
 
   if ((newval.it_value.tv_sec | newval.it_value.tv_usec) == 0)
     {
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.