summaryrefslogtreecommitdiffstats
path: root/lib/librthread/rthread_tls.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2005-12-14 05:42:07 +0000
committertedu <tedu@openbsd.org>2005-12-14 05:42:07 +0000
commit67049442ff9023e55c742077215b606cb65f2e25 (patch)
tree48fbb460c9e58c28731c6638365068098f981aac /lib/librthread/rthread_tls.c
parentthere should be a lock around the tls key table (diff)
downloadwireguard-openbsd-67049442ff9023e55c742077215b606cb65f2e25.tar.xz
wireguard-openbsd-67049442ff9023e55c742077215b606cb65f2e25.zip
the beatings will continue until morale improves
Diffstat (limited to 'lib/librthread/rthread_tls.c')
-rw-r--r--lib/librthread/rthread_tls.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/librthread/rthread_tls.c b/lib/librthread/rthread_tls.c
index e510aa589b5..05311c11d7e 100644
--- a/lib/librthread/rthread_tls.c
+++ b/lib/librthread/rthread_tls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_tls.c,v 1.4 2005/12/14 05:38:31 tedu Exp $ */
+/* $OpenBSD: rthread_tls.c,v 1.5 2005/12/14 05:42:07 tedu Exp $ */
/*
* Copyright (c) 2004 Ted Unangst <tedu@openbsd.org>
* All Rights Reserved.
@@ -72,6 +72,9 @@ int
pthread_key_delete(pthread_key_t key)
{
+ if (rkeys[key].used)
+ return (EINVAL);
+
_spinlock(&rkeyslock);
rkeys[key].used = 0;
rkeys[key].destructor = NULL;