xbps: patch from git master to fix xbps-rindex semaphore perms.

This commit is contained in:
Juan RP 2014-02-05 16:23:57 +01:00
parent df938ae28a
commit 17dbf47998
2 changed files with 41 additions and 2 deletions

View file

@ -0,0 +1,39 @@
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

View file

@ -1,8 +1,8 @@
# Template file for 'xbps'
pkgname=xbps
version=0.31
revision=1
#patch_args="-Np1"
revision=2
patch_args="-Np1"
bootstrap=yes
conf_files="/etc/xbps/xbps.conf"
replaces="xbps>=0"