dm0 / rpms / systemd

Forked from rpms/systemd 5 years ago
Clone
c28716f
From 185aa53dbf2dc882940487b35fae6dccd5097466 Mon Sep 17 00:00:00 2001
c28716f
From: Seth Jennings <sjenning@redhat.com>
c28716f
Date: Tue, 5 May 2015 13:31:01 -0500
c28716f
Subject: [PATCH] Fix permissions on /run/systemd/nspawn/locks
c28716f
c28716f
machined is getting an EACCES when trying to create the lock file for
c28716f
images because the mode on /run/systemd/nspawn/locks is 0600.
c28716f
c28716f
mkdir("/run/systemd/nspawn/locks", 0600) = -1 EEXIST (File exists)
c28716f
stat("/run/systemd/nspawn/locks", {st_mode=S_IFDIR|0600, st_size=40, ...}) = 0
c28716f
open("/run/systemd/nspawn/locks/inode-41:256", O_RDWR|O_CREAT|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC, 0600) = -1 EACCES (Permission denied)
c28716f
c28716f
This commit adjusts the mode to 0700 to correct the issue.
c28716f
c28716f
(cherry picked from commit 7e7cddb22493642dad826ec42ac00979f40b2d17)
c28716f
---
c28716f
 src/shared/machine-image.c | 4 ++--
c28716f
 1 file changed, 2 insertions(+), 2 deletions(-)
c28716f
c28716f
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
c28716f
index 8d61507e84..c02ee814c4 100644
c28716f
--- a/src/shared/machine-image.c
c28716f
+++ b/src/shared/machine-image.c
c28716f
@@ -601,7 +601,7 @@ int image_path_lock(const char *path, int operation, LockFile *global, LockFile
c28716f
                 return r;
c28716f
 
c28716f
         if (p) {
c28716f
-                mkdir_p("/run/systemd/nspawn/locks", 0600);
c28716f
+                mkdir_p("/run/systemd/nspawn/locks", 0700);
c28716f
 
c28716f
                 r = make_lock_file(p, operation, global);
c28716f
                 if (r < 0) {
c28716f
@@ -628,7 +628,7 @@ int image_name_lock(const char *name, int operation, LockFile *ret) {
c28716f
         if (streq(name, ".host"))
c28716f
                 return -EBUSY;
c28716f
 
c28716f
-        mkdir_p("/run/systemd/nspawn/locks", 0600);
c28716f
+        mkdir_p("/run/systemd/nspawn/locks", 0700);
c28716f
         p = strjoina("/run/systemd/nspawn/locks/name-", name);
c28716f
 
c28716f
         return make_lock_file(p, operation, ret);