From d6766132c2a7eb57c26ff47fdc05c2f561842659 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 4 Jan 2017 09:06:49 +0000 Subject: [PATCH] run: ensure pthread_condattr_{init,setclock} is successful MFC after: 1 week Reported by: Coverity CID: 1268631, 1268633 --- contrib/netbsd-tests/lib/libpthread/t_condwait.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/netbsd-tests/lib/libpthread/t_condwait.c b/contrib/netbsd-tests/lib/libpthread/t_condwait.c index 17bbb89df76e..99793d00550c 100644 --- a/contrib/netbsd-tests/lib/libpthread/t_condwait.c +++ b/contrib/netbsd-tests/lib/libpthread/t_condwait.c @@ -42,6 +42,8 @@ __RCSID("$NetBSD: t_condwait.c,v 1.4 2013/04/12 17:18:11 christos Exp $"); #ifdef __FreeBSD__ #include + +#include "h_common.h" #endif #define WAITTIME 2 /* Timeout wait secound */ @@ -60,8 +62,13 @@ run(void *param) clck = *(clockid_t *)param; +#ifdef __FreeBSD__ + PTHREAD_REQUIRE(pthread_condattr_init(&attr)); + PTHREAD_REQUIRE(pthread_condattr_setclock(&attr, clck)); +#else pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, clck); /* MONOTONIC or MONOTONIC */ +#endif pthread_cond_init(&cond, &attr); ATF_REQUIRE_EQ((ret = pthread_mutex_lock(&m)), 0);