mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-06 13:17:44 +03:00
tmpfiles: check the directory we were supposed to create, not its parent
This current code checks the wrong directory. This was broken in4c39d899ff
which converted the previous code incorrectly. (cherry picked from commit92631578ff
) (cherry picked from commit625472b219
)
This commit is contained in:
parent
a77b81f124
commit
8b674cf43f
@ -1641,15 +1641,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;
|
r = btrfs_is_subvol(empty_to_root(arg_root)) > 0;
|
||||||
}
|
}
|
||||||
if (!r)
|
if (!r)
|
||||||
/* Don't create a subvolume unless the root directory is
|
/* Don't create a subvolume unless the root directory is one, too. We do this under
|
||||||
* one, too. We do this under the assumption that if the
|
* the assumption that if the root directory is just a plain directory (i.e. very
|
||||||
* 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
|
||||||
* light-weight), we shouldn't try to split it up into
|
* heavy-weight). Thus, chroot() environments and suchlike will get a full brtfs
|
||||||
* subvolumes (i.e. more heavy-weight). Thus, chroot()
|
* subvolume set up below their tree only if they specifically set up a btrfs
|
||||||
* environments and suchlike will get a full brtfs
|
* subvolume for the root dir too. */
|
||||||
* subvolume set up below their tree only if they
|
|
||||||
* specifically set up a btrfs subvolume for the root
|
|
||||||
* dir too. */
|
|
||||||
|
|
||||||
subvol = false;
|
subvol = false;
|
||||||
else {
|
else {
|
||||||
@ -1669,7 +1666,7 @@ static int create_directory_or_subvolume(const char *path, mode_t mode, bool sub
|
|||||||
if (!IN_SET(r, -EEXIST, -EROFS))
|
if (!IN_SET(r, -EEXIST, -EROFS))
|
||||||
return log_error_errno(r, "Failed to create directory or subvolume \"%s\": %m", path);
|
return log_error_errno(r, "Failed to create directory or subvolume \"%s\": %m", path);
|
||||||
|
|
||||||
k = is_dir_fd(pfd);
|
k = is_dir_full(pfd, basename(path), /* follow= */ false);
|
||||||
if (k == -ENOENT && r == -EROFS)
|
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);
|
return log_error_errno(r, "%s does not exist and cannot be created as the file system is read-only.", path);
|
||||||
if (k < 0)
|
if (k < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user