From: Lennart Poettering Date: Mon, 22 Jan 2018 20:10:27 +0000 (+0100) Subject: tmpfiles: shortcut path_set_perms() if there's nothing to do X-Git-Tag: v237~39^2~5 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fsystemd.git;a=commitdiff_plain;h=59793c8f2e29507c2f6cd8bd1e8785bfbefd2952 tmpfiles: shortcut path_set_perms() if there's nothing to do No need to open() anything in that case, hence don't. --- diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 3fdbfca9a27..c11a649c2f9 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -761,6 +761,9 @@ static int path_set_perms(Item *i, const char *path) { assert(i); assert(path); + if (!i->mode_set && !i->uid_set && !i->gid_set) + goto shortcut; + /* We open the file with O_PATH here, to make the operation * somewhat atomic. Also there's unfortunately no fchmodat() * with AT_SYMLINK_NOFOLLOW, hence we emulate it here via @@ -778,7 +781,6 @@ static int path_set_perms(Item *i, const char *path) { } log_full_errno(level, errno, "Adjusting owner and mode for %s failed: %m", path); - return r; } @@ -830,6 +832,7 @@ static int path_set_perms(Item *i, const char *path) { fd = safe_close(fd); +shortcut: return label_fix(path, false, false); }