]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: fix check for figuring out whether to call chmod()
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Jan 2018 20:11:04 +0000 (21:11 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 Jan 2018 20:19:00 +0000 (21:19 +0100)
No need to call chown() if everything matches already.

src/tmpfiles/tmpfiles.c

index c11a649c2f96da389471915e2c3367f4a5e386e8..d733768f277bdf9d4d9c1c048372521cfc9466d7 100644 (file)
@@ -817,8 +817,8 @@ static int path_set_perms(Item *i, const char *path) {
                 }
         }
 
-        if ((i->uid != st.st_uid || i->gid != st.st_gid) &&
-            (i->uid_set || i->gid_set)) {
+        if ((i->uid_set && i->uid != st.st_uid) ||
+            (i->gid_set && i->gid != st.st_gid)) {
                 log_debug("Changing \"%s\" to owner "UID_FMT":"GID_FMT,
                           path,
                           i->uid_set ? i->uid : UID_INVALID,