From d1d59eeb4720371d255fcee025e9e7d96bd625d1 Mon Sep 17 00:00:00 2001 From: Djalal Harouni Date: Thu, 16 Mar 2017 03:30:15 +0100 Subject: [PATCH] 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. --- src/shared/base-filesystem.c | 2 ++ 1 file changed, 2 insertions(+) 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) {