mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 09:02:44 +00:00
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:
parent
941e286383
commit
41e160536a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202185
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user