diff --git a/NEWS b/NEWS index f8b27d3a..0580c156 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ 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-rindex(8): use a POSIX named semaphore in modes that can modify diff --git a/bin/xbps-rindex/sem.c b/bin/xbps-rindex/sem.c index 8684af12..8cdfa671 100644 --- a/bin/xbps-rindex/sem.c +++ b/bin/xbps-rindex/sem.c @@ -36,6 +36,7 @@ struct idxlock * index_lock(struct xbps_handle *xhp) { struct idxlock *il; + mode_t myumask; if ((il = malloc(sizeof(struct idxlock))) == NULL) return NULL; @@ -48,7 +49,10 @@ index_lock(struct xbps_handle *xhp) /* * Create/open the POSIX named semaphore. */ + myumask = umask(0); il->sem = sem_open(il->semname, O_CREAT, 0660, 1); + umask(myumask); + if (il->sem == SEM_FAILED) { fprintf(stderr, "%s: failed to create/open named " "semaphore: %s\n", _XBPS_RINDEX, strerror(errno));