about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-02-22 16:10:00 +0000
committerUlrich Drepper <drepper@redhat.com>1999-02-22 16:10:00 +0000
commit69b3b3cb3873d59edfebae0cb7db58166d78f3a6 (patch)
treea0dfa2a742f65dec34dddb7179c486d1cd0ee4f7 /sysdeps/unix
parent555d4c582e3189a3a823debfff79761b8283df1f (diff)
downloadglibc-69b3b3cb3873d59edfebae0cb7db58166d78f3a6.tar.gz
glibc-69b3b3cb3873d59edfebae0cb7db58166d78f3a6.tar.xz
glibc-69b3b3cb3873d59edfebae0cb7db58166d78f3a6.zip
Update.
1999-02-22  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/clock.c: Don't test return value of
	__times [PR libc/990].
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/clock.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/clock.c b/sysdeps/unix/sysv/linux/clock.c
index 372afdd149..52268c959c 100644
--- a/sysdeps/unix/sysv/linux/clock.c
+++ b/sysdeps/unix/sysv/linux/clock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,8 +27,14 @@ clock (void)
   struct tms buf;
   long clk_tck = __sysconf (_SC_CLK_TCK);
 
-  if (__times (&buf) < 0)
-    return (clock_t) -1;
+  /* We don't check for errors here.  The only error the kernel
+     returns is EFAULT if the value cannot be written to the struct we
+     pass a pointer to.  Otherwise the kernel returns an `unsigned
+     long' value which is the number of jiffies since system start.
+     But this number can be negative (when read as `long') when the
+     system is up for some time.  Ignoring errors should therefore
+     have no negative impacts but solve the problem.  */
+  __times (&buf);
 
   return
     (clk_tck <= CLOCKS_PER_SEC)