disallow cpu time clocks as condattr clock values
authorRich Felker <dalias@aerifal.cx>
Tue, 8 Mar 2011 07:32:42 +0000 (02:32 -0500)
committerRich Felker <dalias@aerifal.cx>
Tue, 8 Mar 2011 07:32:42 +0000 (02:32 -0500)
src/thread/pthread_condattr_setclock.c

index bf7455238c76a1779eeb194e9c1d8f3b509fd2c4..cd2cecc98bca6b52a6b02e6518cc1ef398dbd9c6 100644 (file)
@@ -2,7 +2,7 @@
 
 int pthread_condattr_setclock(pthread_condattr_t *a, clockid_t clk)
 {
-       if (clk < 0) return EINVAL;
+       if (clk < 0 || clk-2U < 2) return EINVAL;
        *a &= 0x80000000;
        *a |= clk;
        return 0;