daandemeyer / rpms / systemd

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