summaryrefslogtreecommitdiffstats
path: root/src/partition
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-10-04 21:33:52 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-10-04 21:33:52 +0200
commit413d3ce1b76b42ba691eea54cd1704b14602442e (patch)
tree9c34cdf3b6909745dae9f94debb4ffc875f3d454 /src/partition
parentMerge pull request #34608 from DaanDeMeyer/ukify (diff)
downloadsystemd-413d3ce1b76b42ba691eea54cd1704b14602442e.tar.xz
systemd-413d3ce1b76b42ba691eea54cd1704b14602442e.zip
repart: Don't copy root directory mode from source file
If the source is a file, don't copy the mode and such from it to the root directory, even if the target is /.
Diffstat (limited to 'src/partition')
-rw-r--r--src/partition/repart.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c
index 95ae0a3158..c87cceb4da 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -5518,6 +5518,8 @@ static int do_copy_files(Context *context, Partition *p, const char *root) {
return -errno;
sfd = chase_and_open(*source, arg_copy_source, CHASE_PREFIX_ROOT, O_PATH|O_DIRECTORY|O_CLOEXEC|O_NOCTTY, NULL);
+ if (sfd == -ENOTDIR)
+ continue;
if (sfd < 0)
return log_error_errno(sfd, "Failed to open source file '%s%s': %m", strempty(arg_copy_source), *source);