diff options
author | 2000-01-06 07:20:01 +0000 | |
---|---|---|
committer | 2000-01-06 07:20:01 +0000 | |
commit | a810d2e1644cfa5e040dba16466b9ff56e5974c5 (patch) | |
tree | 49e49183a068c4b0611d7e80bf1e8e5eb5878283 /lib/libc_r | |
parent | oops (diff) | |
download | wireguard-openbsd-a810d2e1644cfa5e040dba16466b9ff56e5974c5.tar.xz wireguard-openbsd-a810d2e1644cfa5e040dba16466b9ff56e5974c5.zip |
unused var, test lock return
Diffstat (limited to 'lib/libc_r')
-rw-r--r-- | lib/libc_r/uthread/uthread_once.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc_r/uthread/uthread_once.c b/lib/libc_r/uthread/uthread_once.c index 27b3a4d594e..a69116bfa33 100644 --- a/lib/libc_r/uthread/uthread_once.c +++ b/lib/libc_r/uthread/uthread_once.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_once.c,v 1.3 1999/11/25 07:01:40 d Exp $ */ +/* $OpenBSD: uthread_once.c,v 1.4 2000/01/06 07:20:01 d Exp $ */ /* * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -39,8 +39,11 @@ int pthread_once(pthread_once_t * once_control, void (*init_routine) (void)) { + int ret; + if (once_control->state == PTHREAD_NEEDS_INIT) { - pthread_mutex_lock(&(once_control->mutex)); + if ((ret = pthread_mutex_lock(&(once_control->mutex))) != 0) + return ret; if (once_control->state == PTHREAD_NEEDS_INIT) { init_routine(); once_control->state = PTHREAD_DONE_INIT; |