daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
c62b8e
From a781c22627a108d2fdcfaf428f6fefca122636a9 Mon Sep 17 00:00:00 2001
c62b8e
From: Lennart Poettering <lennart@poettering.net>
c62b8e
Date: Mon, 22 Jan 2018 21:11:04 +0100
c62b8e
Subject: [PATCH] tmpfiles: fix check for figuring out whether to call chmod()
c62b8e
c62b8e
No need to call chown() if everything matches already.
c62b8e
c62b8e
(cherry picked from commit dc2335669afddc767eea2757f8d7dfc7a8f927fa)
c62b8e
c62b8e
Related: #1620110
c62b8e
---
c62b8e
 src/tmpfiles/tmpfiles.c | 4 ++--
c62b8e
 1 file changed, 2 insertions(+), 2 deletions(-)
c62b8e
c62b8e
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
c62b8e
index 663f6c8b2d..1adcb74e68 100644
c62b8e
--- a/src/tmpfiles/tmpfiles.c
c62b8e
+++ b/src/tmpfiles/tmpfiles.c
c62b8e
@@ -655,8 +655,8 @@ static int path_set_perms(Item *i, const char *path) {
c62b8e
                 }
c62b8e
         }
c62b8e
 
c62b8e
-        if ((i->uid != st.st_uid || i->gid != st.st_gid) &&
c62b8e
-            (i->uid_set || i->gid_set)) {
c62b8e
+        if ((i->uid_set && i->uid != st.st_uid) ||
c62b8e
+            (i->gid_set && i->gid != st.st_gid)) {
c62b8e
                 log_debug("Changing \"%s\" to owner "UID_FMT":"GID_FMT,
c62b8e
                           path,
c62b8e
                           i->uid_set ? i->uid : UID_INVALID,