about summary refs log tree commit diff
path: root/nptl/pthread_clockjoin.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-23 13:47:18 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-25 10:46:25 -0300
commitb4c3446836285fc3d1465dc9b8c587c8f50e4922 (patch)
treef70425bcc062abc3523456f7edf4ab185946e3b9 /nptl/pthread_clockjoin.c
parent74f418b29d1e9463028f2ae4cc2a9c74d39aeaab (diff)
downloadglibc-b4c3446836285fc3d1465dc9b8c587c8f50e4922.tar.gz
glibc-b4c3446836285fc3d1465dc9b8c587c8f50e4922.tar.xz
glibc-b4c3446836285fc3d1465dc9b8c587c8f50e4922.zip
nptl: Return EINVAL for invalid clock for pthread_clockjoin_np
The align the GNU extension with the others one that accept specify
which clock to wait for (such as pthread_mutex_clocklock).

Check on x86_64-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'nptl/pthread_clockjoin.c')
-rw-r--r--nptl/pthread_clockjoin.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/nptl/pthread_clockjoin.c b/nptl/pthread_clockjoin.c
index 0baba1e83d..3d54fe588f 100644
--- a/nptl/pthread_clockjoin.c
+++ b/nptl/pthread_clockjoin.c
@@ -17,12 +17,16 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <time.h>
+#include <futex-internal.h>
 #include "pthreadP.h"
 
 int
 __pthread_clockjoin_np64 (pthread_t threadid, void **thread_return,
                           clockid_t clockid, const struct __timespec64 *abstime)
 {
+  if (!futex_abstimed_supported_clockid (clockid))
+    return EINVAL;
+
   return __pthread_clockjoin_ex (threadid, thread_return,
                                  clockid, abstime, true);
 }