summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2003-01-22 23:18:06 +0000
committerthorpej <thorpej@NetBSD.org>2003-01-22 23:18:06 +0000
commit1b4d724c8eb2cbcac5cb235e5755b370c74608bb (patch)
tree8d2ded0ddb0254fbf486107011a7044648c94a25 /lib/libpthread
parent413b4a751949ff4f10b584f9bf1528b9b1ab561e (diff)
sem_init(): oops, only destroy the ksem on error if it is a ksem.
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/sem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libpthread/sem.c b/lib/libpthread/sem.c
index 1fe0c09667a..256e4ef2e55 100644
--- a/lib/libpthread/sem.c
+++ b/lib/libpthread/sem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sem.c,v 1.3 2003/01/22 22:51:42 thorpej Exp $ */
+/* $NetBSD: sem.c,v 1.4 2003/01/22 23:18:06 thorpej Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -140,7 +140,8 @@ sem_init(sem_t *sem, int pshared, unsigned int value)
return (-1);
if ((error = sem_alloc(value, semid, sem)) != 0) {
- _ksem_destroy(semid);
+ if (semid != USEM_USER)
+ _ksem_destroy(semid);
errno = error;
return (-1);
}