40 lines
1.1 KiB
Diff
40 lines
1.1 KiB
Diff
From 306fe4968e88111a95b28289d086f67d17252844 Mon Sep 17 00:00:00 2001
|
|
From: Juan RP <xtraeme@gmail.com>
|
|
Date: Wed, 5 Feb 2014 15:27:35 +0100
|
|
Subject: [PATCH] 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.
|
|
---
|
|
NEWS | 3 +++
|
|
bin/xbps-rindex/sem.c | 4 ++++
|
|
2 files changed, 7 insertions(+)
|
|
|
|
diff --git a/bin/xbps-rindex/sem.c b/bin/xbps-rindex/sem.c
|
|
index 8684af1..8cdfa67 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));
|
|
--
|
|
1.8.5.3
|
|
|