summaryrefslogtreecommitdiff
path: root/lib/libpthread/pthread_cond.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2013-04-01 13:28:21 +0000
committerchristos <christos@NetBSD.org>2013-04-01 13:28:21 +0000
commit3a5f88916f1fb8a01202e57a83615efb720e3d0f (patch)
tree6ddbb33bcedfa73c30900a4d866706f1f7b50ada /lib/libpthread/pthread_cond.c
parent31760de83eabe683df81f18ec3b83e7d99a06f9c (diff)
for safety, declare mono on the outermost block it is used.
Diffstat (limited to 'lib/libpthread/pthread_cond.c')
-rw-r--r--lib/libpthread/pthread_cond.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libpthread/pthread_cond.c b/lib/libpthread/pthread_cond.c
index 5a318f5e381..c970d063f4b 100644
--- a/lib/libpthread/pthread_cond.c
+++ b/lib/libpthread/pthread_cond.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_cond.c,v 1.60 2013/03/28 18:07:12 christos Exp $ */
+/* $NetBSD: pthread_cond.c,v 1.61 2013/04/01 13:28:21 christos Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_cond.c,v 1.60 2013/03/28 18:07:12 christos Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.61 2013/04/01 13:28:21 christos Exp $");
#include <stdlib.h>
#include <errno.h>
@@ -131,6 +131,7 @@ pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
{
pthread_t self;
int retval;
+ struct timespec mono;
if (__predict_false(__uselibcstub))
return __libc_cond_timedwait_stub(cond, mutex, abstime);
@@ -147,7 +148,7 @@ pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
* extra system calls!
*/
if (pthread_cond_getclock(cond) == CLOCK_MONOTONIC) {
- struct timespec mono, real;
+ struct timespec real;
if (clock_gettime(CLOCK_REALTIME, &real) == -1 ||
clock_gettime(CLOCK_MONOTONIC, &mono) == -1)
return errno;