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.
This commit is contained in:
Djalal Harouni 2017-03-16 03:30:15 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent bda99fab31
commit d1d59eeb47

View file

@ -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) {