Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2017 09:06:49 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311274 - head/contrib/netbsd-tests/lib/libpthread
Message-ID:  <201701040906.v0496nIg094878@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed Jan  4 09:06:49 2017
New Revision: 311274
URL: https://svnweb.freebsd.org/changeset/base/311274

Log:
  run: ensure pthread_condattr_{init,setclock} is successful
  
  MFC after:	1 week
  Reported by:	Coverity
  CID:		1268631, 1268633

Modified:
  head/contrib/netbsd-tests/lib/libpthread/t_condwait.c

Modified: head/contrib/netbsd-tests/lib/libpthread/t_condwait.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libpthread/t_condwait.c	Wed Jan  4 09:00:16 2017	(r311273)
+++ head/contrib/netbsd-tests/lib/libpthread/t_condwait.c	Wed Jan  4 09:06:49 2017	(r311274)
@@ -42,6 +42,8 @@ __RCSID("$NetBSD: t_condwait.c,v 1.4 201
 
 #ifdef __FreeBSD__
 #include <sys/time.h>
+
+#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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701040906.v0496nIg094878>