From 41e160536a1312617c8678997dff309a9c2a89d7 Mon Sep 17 00:00:00 2001 From: David Xu Date: Wed, 13 Jan 2010 08:53:23 +0000 Subject: [PATCH] Return SEM_FAILED instead of NULL, though there are same, but the SEM_FAILED is more suitable name. In function, sem_close(), always set errno on error. --- lib/libc/gen/sem_new.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c index a4bb4f3227bf..1ec39baf9740 100644 --- a/lib/libc/gen/sem_new.c +++ b/lib/libc/gen/sem_new.c @@ -147,13 +147,13 @@ _sem_open(const char *name, int flags, ...) if (name[0] != '/') { errno = EINVAL; - return (NULL); + return (SEM_FAILED); } name++; if (flags & ~(O_CREAT|O_EXCL)) { errno = EINVAL; - return (NULL); + return (SEM_FAILED); } _pthread_once(&once, sem_module_init); @@ -275,6 +275,7 @@ _sem_close(sem_t *sem) return (0); } _pthread_mutex_unlock(&sem_llock); + errno = EINVAL; return (-1); }