anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0717-tmpfiles-fix-check-for-figuring-out-whether-to-call-.patch

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