diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-01-13 08:53:23 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-01-13 08:53:23 +0000 |
commit | 028e43e0f75e457b7b5a88b9c7024a9c1898b990 (patch) | |
tree | 8ab4ced2176858263b92e99a301cb56368818376 | |
parent | 38619cd9707a9e9b073d14381cde7d38e14cce71 (diff) | |
download | FreeBSD-src-028e43e0f75e457b7b5a88b9c7024a9c1898b990.zip FreeBSD-src-028e43e0f75e457b7b5a88b9c7024a9c1898b990.tar.gz |
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.
-rw-r--r-- | lib/libc/gen/sem_new.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c index a4bb4f3..1ec39ba 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); } |