copy: add new flags that cause a seek to beginning of files before copying
This is quite useful in various cases where we so far did this manually.
This commit is contained in:
committed by
Luca Boccassi
parent
6fb5ec3dd1
commit
5adfd44c9e
@@ -554,10 +554,7 @@ static int copy_file_with_version_check(
|
||||
* might be left at the end of the file. (Resetting before rather than after a copy attempt is safer
|
||||
* because a previous attempt might have failed half-way, leaving the file offset at some undefined
|
||||
* place.) */
|
||||
if (lseek(source_fd, 0, SEEK_SET) < 0)
|
||||
return log_error_errno(errno, "Failed to seek in \"%s\": %m", source_path);
|
||||
|
||||
r = copy_bytes(source_fd, write_fd, UINT64_MAX, COPY_REFLINK);
|
||||
r = copy_bytes(source_fd, write_fd, UINT64_MAX, COPY_REFLINK|COPY_SEEK0_SOURCE);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to copy data from \"%s\" to \"%s\": %m", source_path, dest_path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user