summary refs log tree commit diff
path: root/sysdeps/mach/hurd/setitimer.c
diff options
context:
space:
mode:
authorThomas Bushnell, BSG <thomas@gnu.org>1996-08-26 20:34:42 +0000
committerThomas Bushnell, BSG <thomas@gnu.org>1996-08-26 20:34:42 +0000
commit485604b41c5554c01542b2b1a8f24d3be59a678b (patch)
tree736f3ebfd3accfec6b5b90b0391d1e04f4978b60 /sysdeps/mach/hurd/setitimer.c
parent548330d38eefef72c138211300e867733613c7c2 (diff)
downloadglibc-485604b41c5554c01542b2b1a8f24d3be59a678b.tar.gz
glibc-485604b41c5554c01542b2b1a8f24d3be59a678b.tar.xz
glibc-485604b41c5554c01542b2b1a8f24d3be59a678b.zip
*** empty log message ***
Diffstat (limited to 'sysdeps/mach/hurd/setitimer.c')
-rw-r--r--sysdeps/mach/hurd/setitimer.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
index 01c17f7725..479b3273c3 100644
--- a/sysdeps/mach/hurd/setitimer.c
+++ b/sysdeps/mach/hurd/setitimer.c
@@ -140,7 +140,7 @@ static int
 setitimer_locked (const struct itimerval *new, struct itimerval *old,
 		  void *crit)
 {
-  struct itimerval newval = *new;
+  struct itimerval newval;
   struct timeval now, remaining, elapsed;
   struct timeval old_interval;
   error_t err;
@@ -154,6 +154,18 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old,
       _hurd_itimer_thread = MACH_PORT_NULL;
     }
 
+  if (!new)
+    {
+      /* Just return the current value in OLD without changing anything.
+	 This is what BSD does, even though it's not documented. */
+      if (old)
+	*old = _hurd_itemerval;
+      spin_unlock (&_hurd_itimer_lock);
+      _hurd_critical_section_unlock (crit);
+      return 0;
+    }
+
+  newval = *new;
   if ((newval.it_value.tv_sec | newval.it_value.tv_usec) != 0)
     {
       /* Make sure the itimer thread is set up.  */