1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-22 22:03:43 +03:00

repart: Make sure we seek to beginning of partition target before copy

(cherry picked from commit 6eccec00fb50e1a35f5a11e3339d634541bcc3a8)
This commit is contained in:
Daan De Meyer 2023-03-16 22:10:50 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent fd963d1bc8
commit 659e7f274e

View File

@ -3225,6 +3225,9 @@ static int partition_target_sync(Context *context, Partition *p, PartitionTarget
if (lseek(whole_fd, p->offset, SEEK_SET) == (off_t) -1)
return log_error_errno(errno, "Failed to seek to partition offset: %m");
if (lseek(t->fd, 0, SEEK_SET) == (off_t) -1)
return log_error_errno(errno, "Failed to seek to start of temporary file: %m");
r = copy_bytes(t->fd, whole_fd, UINT64_MAX, COPY_REFLINK|COPY_HOLES|COPY_FSYNC);
if (r < 0)
return log_error_errno(r, "Failed to copy bytes to partition: %m");