summaryrefslogtreecommitdiff
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-07-13 23:44:45 +0200
committerLennart Poettering <lennart@poettering.net>2022-07-14 10:12:37 +0200
commit92631578fff1568fa8e99f96de05baae5b258ffe (patch)
tree1144a4cab108eb9f647a98b774e291769417164b /src/tmpfiles
parenta586dc791ca465f4087473d2ad6794b7776aee2d (diff)
downloadsystemd-92631578fff1568fa8e99f96de05baae5b258ffe.tar.gz
tmpfiles: check the directory we were supposed to create, not its parent
This current code checks the wrong directory. This was broken in 4c39d899ff00e90b7290e4985696f321d7f2726f which converted the previous code incorrectly.
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/tmpfiles.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 0e389d3a31..0069f444e9 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1629,15 +1629,12 @@ static int create_directory_or_subvolume(const char *path, mode_t mode, bool sub
r = btrfs_is_subvol(empty_to_root(arg_root)) > 0;
}
if (!r)
- /* Don't create a subvolume unless the root directory is
- * one, too. We do this under the assumption that if the
- * root directory is just a plain directory (i.e. very
- * light-weight), we shouldn't try to split it up into
- * subvolumes (i.e. more heavy-weight). Thus, chroot()
- * environments and suchlike will get a full brtfs
- * subvolume set up below their tree only if they
- * specifically set up a btrfs subvolume for the root
- * dir too. */
+ /* Don't create a subvolume unless the root directory is one, too. We do this under
+ * the assumption that if the root directory is just a plain directory (i.e. very
+ * light-weight), we shouldn't try to split it up into subvolumes (i.e. more
+ * heavy-weight). Thus, chroot() environments and suchlike will get a full brtfs
+ * subvolume set up below their tree only if they specifically set up a btrfs
+ * subvolume for the root dir too. */
subvol = false;
else {
@@ -1657,7 +1654,7 @@ static int create_directory_or_subvolume(const char *path, mode_t mode, bool sub
if (!IN_SET(r, -EEXIST, -EROFS))
return log_error_errno(r, "Failed to create directory or subvolume \"%s\": %m", path);
- k = is_dir_fd(pfd);
+ k = is_dir_full(pfd, bn, /* follow= */ false);
if (k == -ENOENT && r == -EROFS)
return log_error_errno(r, "%s does not exist and cannot be created as the file system is read-only.", path);
if (k < 0)