about summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/clock_getres.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
index 91c57629ca..a2d466607e 100644
--- a/sysdeps/posix/clock_getres.c
+++ b/sysdeps/posix/clock_getres.c
@@ -64,9 +64,19 @@ clock_getres (clockid_t clock_id, struct timespec *res)
       break;
 #endif	/* handled REALTIME */
 
+    default:
+#if HP_TIMING_AVAIL
+      if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
+	  != CLOCK_THREAD_CPUTIME_ID)
+#endif
+	{
+	  __set_errno (EINVAL);
+	  break;
+	}
+
 #if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
+      /* FALLTHROUGH.  */
     case CLOCK_PROCESS_CPUTIME_ID:
-    case CLOCK_THREAD_CPUTIME_ID:
       {
 	if (__builtin_expect (nsec == 0, 0))
 	  {
@@ -93,10 +103,6 @@ clock_getres (clockid_t clock_id, struct timespec *res)
       }
       break;
 #endif
-
-    default:
-      __set_errno (EINVAL);
-      break;
     }
 
   return retval;