xbps-rindex: clear file permission bits before creating our named semaphore.
Due to the file permission bits (umask(3)) the semaphore wasn't created with correct permissions.
This commit is contained in:
parent
9c124aa162
commit
306fe4968e
3
NEWS
3
NEWS
@ -1,5 +1,8 @@
|
|||||||
xbps-0.32 (???):
|
xbps-0.32 (???):
|
||||||
|
|
||||||
|
* xbps-rindex(8): set correct permissions to the POSIX semaphore
|
||||||
|
by clearing file permission bits before its creation.
|
||||||
|
|
||||||
xbps-0.31 (2014-02-01):
|
xbps-0.31 (2014-02-01):
|
||||||
|
|
||||||
* xbps-rindex(8): use a POSIX named semaphore in modes that can modify
|
* xbps-rindex(8): use a POSIX named semaphore in modes that can modify
|
||||||
|
@ -36,6 +36,7 @@ struct idxlock *
|
|||||||
index_lock(struct xbps_handle *xhp)
|
index_lock(struct xbps_handle *xhp)
|
||||||
{
|
{
|
||||||
struct idxlock *il;
|
struct idxlock *il;
|
||||||
|
mode_t myumask;
|
||||||
|
|
||||||
if ((il = malloc(sizeof(struct idxlock))) == NULL)
|
if ((il = malloc(sizeof(struct idxlock))) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -48,7 +49,10 @@ index_lock(struct xbps_handle *xhp)
|
|||||||
/*
|
/*
|
||||||
* Create/open the POSIX named semaphore.
|
* Create/open the POSIX named semaphore.
|
||||||
*/
|
*/
|
||||||
|
myumask = umask(0);
|
||||||
il->sem = sem_open(il->semname, O_CREAT, 0660, 1);
|
il->sem = sem_open(il->semname, O_CREAT, 0660, 1);
|
||||||
|
umask(myumask);
|
||||||
|
|
||||||
if (il->sem == SEM_FAILED) {
|
if (il->sem == SEM_FAILED) {
|
||||||
fprintf(stderr, "%s: failed to create/open named "
|
fprintf(stderr, "%s: failed to create/open named "
|
||||||
"semaphore: %s\n", _XBPS_RINDEX, strerror(errno));
|
"semaphore: %s\n", _XBPS_RINDEX, strerror(errno));
|
||||||
|
Loading…
Reference in New Issue
Block a user