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
This commit is contained in:
Emery Hemingway 2017-08-03 09:44:17 -05:00 committed by Christian Helmuth
parent ad6c94bb09
commit 2d8bfd8569

View File

@ -537,7 +537,7 @@ extern "C" {
if (!attr) if (!attr)
return EINVAL; return EINVAL;
*attr = 0; *attr = nullptr;
return 0; return 0;
} }
@ -545,11 +545,10 @@ extern "C" {
int pthread_condattr_destroy(pthread_condattr_t *attr) 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; return EINVAL;
warning(__func__, " not implemented yet");
return 0; return 0;
} }
@ -557,7 +556,8 @@ extern "C" {
int pthread_condattr_setclock(pthread_condattr_t *attr, int pthread_condattr_setclock(pthread_condattr_t *attr,
clockid_t clock_id) clockid_t clock_id)
{ {
if (!attr || !*attr) /* assert that the attr was produced by the init no-op */
if (!attr || *attr != nullptr)
return EINVAL; return EINVAL;
warning(__func__, " not implemented yet"); warning(__func__, " not implemented yet");