From: Djalal Harouni Date: Thu, 16 Mar 2017 02:30:15 +0000 (+0100) Subject: base-filesystem: skip fchownat() if the previous mkdirat() on same path failed (... X-Git-Tag: v234~368 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d1d59eeb4720371d255fcee025e9e7d96bd625d1;p=thirdparty%2Fsystemd.git base-filesystem: skip fchownat() if the previous mkdirat() on same path failed (#5548) If we are working on a path that was marked to be ignored on errors, and the mkdirat() fails then add a continue statement and skip fchownat() call. This avoids the case where UID/GID are valid and we run fchownat() on non existent path which will fail hard even on paths that we want to ignore in case of errors. --- diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c index 127cbe44e38..f2d8bcf6e36 100644 --- a/src/shared/base-filesystem.c +++ b/src/shared/base-filesystem.c @@ -117,6 +117,8 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { if (!table[i].ignore_failure) return -errno; + + continue; } if (uid != UID_INVALID || gid != UID_INVALID) {