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.
This commit is contained in:
David Xu 2010-01-13 08:53:23 +00:00
parent 941e286383
commit 41e160536a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202185

View File

@ -147,13 +147,13 @@ _sem_open(const char *name, int flags, ...)
if (name[0] != '/') { if (name[0] != '/') {
errno = EINVAL; errno = EINVAL;
return (NULL); return (SEM_FAILED);
} }
name++; name++;
if (flags & ~(O_CREAT|O_EXCL)) { if (flags & ~(O_CREAT|O_EXCL)) {
errno = EINVAL; errno = EINVAL;
return (NULL); return (SEM_FAILED);
} }
_pthread_once(&once, sem_module_init); _pthread_once(&once, sem_module_init);
@ -275,6 +275,7 @@ _sem_close(sem_t *sem)
return (0); return (0);
} }
_pthread_mutex_unlock(&sem_llock); _pthread_mutex_unlock(&sem_llock);
errno = EINVAL;
return (-1); return (-1);
} }