mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
repart: Use COPY_TRUNCATE
This commit is contained in:
parent
cc45eb592b
commit
ab645e0a90
@ -4070,14 +4070,14 @@ static int do_copy_files(Context *context, Partition *p, const char *root) {
|
|||||||
sfd, ".",
|
sfd, ".",
|
||||||
pfd, fn,
|
pfd, fn,
|
||||||
UID_INVALID, GID_INVALID,
|
UID_INVALID, GID_INVALID,
|
||||||
COPY_REFLINK|COPY_HOLES|COPY_MERGE|COPY_REPLACE|COPY_SIGINT|COPY_HARDLINKS|COPY_ALL_XATTRS|COPY_GRACEFUL_WARN,
|
COPY_REFLINK|COPY_HOLES|COPY_MERGE|COPY_REPLACE|COPY_SIGINT|COPY_HARDLINKS|COPY_ALL_XATTRS|COPY_GRACEFUL_WARN|COPY_TRUNCATE,
|
||||||
denylist);
|
denylist);
|
||||||
} else
|
} else
|
||||||
r = copy_tree_at(
|
r = copy_tree_at(
|
||||||
sfd, ".",
|
sfd, ".",
|
||||||
tfd, ".",
|
tfd, ".",
|
||||||
UID_INVALID, GID_INVALID,
|
UID_INVALID, GID_INVALID,
|
||||||
COPY_REFLINK|COPY_HOLES|COPY_MERGE|COPY_REPLACE|COPY_SIGINT|COPY_HARDLINKS|COPY_ALL_XATTRS|COPY_GRACEFUL_WARN,
|
COPY_REFLINK|COPY_HOLES|COPY_MERGE|COPY_REPLACE|COPY_SIGINT|COPY_HARDLINKS|COPY_ALL_XATTRS|COPY_GRACEFUL_WARN|COPY_TRUNCATE,
|
||||||
denylist);
|
denylist);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to copy '%s%s' to '%s%s': %m",
|
return log_error_errno(r, "Failed to copy '%s%s' to '%s%s': %m",
|
||||||
@ -4110,7 +4110,7 @@ static int do_copy_files(Context *context, Partition *p, const char *root) {
|
|||||||
if (tfd < 0)
|
if (tfd < 0)
|
||||||
return log_error_errno(errno, "Failed to create target file '%s': %m", *target);
|
return log_error_errno(errno, "Failed to create target file '%s': %m", *target);
|
||||||
|
|
||||||
r = copy_bytes(sfd, tfd, UINT64_MAX, COPY_REFLINK|COPY_HOLES|COPY_SIGINT);
|
r = copy_bytes(sfd, tfd, UINT64_MAX, COPY_REFLINK|COPY_HOLES|COPY_SIGINT|COPY_TRUNCATE);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to copy '%s' to '%s%s': %m", *source, strempty(arg_root), *target);
|
return log_error_errno(r, "Failed to copy '%s' to '%s%s': %m", *source, strempty(arg_root), *target);
|
||||||
|
|
||||||
@ -4923,7 +4923,7 @@ static int context_split(Context *context) {
|
|||||||
if (lseek(fd, p->offset, SEEK_SET) < 0)
|
if (lseek(fd, p->offset, SEEK_SET) < 0)
|
||||||
return log_error_errno(errno, "Failed to seek to partition offset: %m");
|
return log_error_errno(errno, "Failed to seek to partition offset: %m");
|
||||||
|
|
||||||
r = copy_bytes(fd, fdt, p->new_size, COPY_REFLINK|COPY_HOLES);
|
r = copy_bytes(fd, fdt, p->new_size, COPY_REFLINK|COPY_HOLES|COPY_TRUNCATE);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to copy to split partition %s: %m", p->split_path);
|
return log_error_errno(r, "Failed to copy to split partition %s: %m", p->split_path);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user