diff options
author | 2011-09-22 04:54:38 +0000 | |
---|---|---|
committer | 2011-09-22 04:54:38 +0000 | |
commit | 2e424845f295abf24eb268e35f3b73a2af7c6ca2 (patch) | |
tree | 4811e8142a528872631bd8ef077e5f5001c2b381 | |
parent | Add tests for pf fragment reassembly with all kinds of overlapping. (diff) | |
download | wireguard-openbsd-2e424845f295abf24eb268e35f3b73a2af7c6ca2.tar.xz wireguard-openbsd-2e424845f295abf24eb268e35f3b73a2af7c6ca2.zip |
Return the correct errno (EBUSY) when pthread_mutex_trylock() is
called on an ERRORCHECK mutex that is locked by this thread. Problem
observed by uwe@
-rw-r--r-- | lib/librthread/rthread_sync.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/librthread/rthread_sync.c b/lib/librthread/rthread_sync.c index 5644eb5cc1d..a602025e818 100644 --- a/lib/librthread/rthread_sync.c +++ b/lib/librthread/rthread_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_sync.c,v 1.23 2010/04/12 03:34:31 guenther Exp $ */ +/* $OpenBSD: rthread_sync.c,v 1.24 2011/09/22 04:54:38 guenther Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> * All Rights Reserved. @@ -277,7 +277,7 @@ _rthread_mutex_lock(pthread_mutex_t *mutexp, int trywait) return (0); } if (mutex->type == PTHREAD_MUTEX_ERRORCHECK) - return (EDEADLK); + return (trywait ? EBUSY : EDEADLK); } if (!_sem_wait((void *)&mutex->sem, trywait)) return (EBUSY); |