From 2d8bfd8569dee6ff546154ca4f8bf4a274925a1b Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 3 Aug 2017 09:44:17 -0500 Subject: [PATCH] pthread: do not error from pthread_condattr_setclock dummy Do not regard a fake condattr object produced by pthread_condattr_init as invalid when passed to no-op dummies. Fix #2471 --- repos/libports/src/lib/pthread/thread.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/repos/libports/src/lib/pthread/thread.cc b/repos/libports/src/lib/pthread/thread.cc index 2aced86e7d..2bda839fb3 100644 --- a/repos/libports/src/lib/pthread/thread.cc +++ b/repos/libports/src/lib/pthread/thread.cc @@ -537,7 +537,7 @@ extern "C" { if (!attr) return EINVAL; - *attr = 0; + *attr = nullptr; return 0; } @@ -545,11 +545,10 @@ extern "C" { int pthread_condattr_destroy(pthread_condattr_t *attr) { - if (!attr || !*attr) + /* assert that the attr was produced by the init no-op */ + if (!attr || *attr != nullptr) return EINVAL; - warning(__func__, " not implemented yet"); - return 0; } @@ -557,7 +556,8 @@ extern "C" { int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id) { - if (!attr || !*attr) + /* assert that the attr was produced by the init no-op */ + if (!attr || *attr != nullptr) return EINVAL; warning(__func__, " not implemented yet");