diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 35b16c71..6cfdc32b 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -881,11 +881,8 @@ _try_clone_from_payload_link (OstreeRepo *self, else { /* This undoes all of the previous writes; we want to generate reflinked data. */ - if (ftruncate (tmpf->fd, 0) < 0) - return glnx_throw_errno_prefix (error, "ftruncate"); - - if (glnx_regfile_copy_bytes (fdf, tmpf->fd, -1) < 0) - return glnx_throw_errno_prefix (error, "regfile copy"); + if (ioctl (tmpf->fd, FICLONE, fdf) < 0) + return glnx_throw_errno_prefix (error, "FICLONE"); return TRUE; }