diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2008-06-20 02:58:01 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2008-06-20 02:58:01 +0000 |
commit | b04fefbc662e23ff7680ea5223fea4ddae29f392 (patch) | |
tree | 5fb7ab8d741c412488ba57007fcc41e4ead1d0a4 | |
parent | 4a2e45d37a3bbf3549a34890420369df9145cb70 (diff) |
Adjust the _SEM_CHECK_VALIDITY macro to detect NULL sem_t instead of
segfaulting.
okay marc@ todd@
-rw-r--r-- | lib/libpthread/uthread/uthread_sem.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_sem.c b/lib/libpthread/uthread/uthread_sem.c index 7078449aad2..925910cbda5 100644 --- a/lib/libpthread/uthread/uthread_sem.c +++ b/lib/libpthread/uthread/uthread_sem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_sem.c,v 1.2 2007/05/18 19:28:50 kurt Exp $ */ +/* $OpenBSD: uthread_sem.c,v 1.3 2008/06/20 02:58:00 kurt Exp $ */ /* * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>. * All rights reserved. @@ -38,7 +38,9 @@ #include "pthread_private.h" #define _SEM_CHECK_VALIDITY(sem) \ - if ((*(sem))->magic != SEM_MAGIC) { \ + if ((sem) == NULL || \ + *(sem) == NULL || \ + (*(sem))->magic != SEM_MAGIC) { \ errno = EINVAL; \ retval = -1; \ goto RETURN; \ |