diff options
author | Jim Meyering <meyering@redhat.com> | 2011-01-31 18:25:58 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-01-31 18:26:06 +0100 |
commit | cc0645fc643d3ea5a06f12f5fad784a2b8097888 (patch) | |
tree | 003a918196b8804d758cdc3d10c8504785ef8885 /tests/cp | |
parent | 96a93f9480e0a420c21db7b58662a6e3ddf16124 (diff) | |
download | coreutils-cc0645fc643d3ea5a06f12f5fad784a2b8097888.tar.xz |
cp: fix copying a sparse file to a pipe
The recent FIEMAP-related changes made it so the unusual case of
copying a sparse file to a non-regular destination (e.g., a pipe)
would erroneously write one byte too many to that destination.
That happened because extent_copy assumed that it could use lseek
to obtain the number of bytes written to the output file descriptor.
That was valid only for regular files.
* src/copy.c (sparse_copy): Add a parameter, to be used by extent_copy,
but not by reg_copy. Adjust callers.
(extent_copy): Maintain new local, dest_pos, using new arg, n_read.
Don't call lseek on dest_fd; use new var, dest_pos, instead.
(copy_reg): Add unused arg.
Diffstat (limited to 'tests/cp')
0 files changed, 0 insertions, 0 deletions