]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
base-filesystem: skip fchownat() if the previous mkdirat() on same path failed (...
authorDjalal Harouni <tixxdz@opendz.org>
Thu, 16 Mar 2017 02:30:15 +0000 (03:30 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Mar 2017 02:30:15 +0000 (22:30 -0400)
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

index 127cbe44e38744bfd85e9f648724a9bb3de7d3de..f2d8bcf6e3635636529ffcfaf053e933f41e3f84 100644 (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) {