diff options
| author | Jim Meyering <meyering@redhat.com> | 2011-01-27 21:01:07 +0100 |
|---|---|---|
| committer | Jim Meyering <meyering@redhat.com> | 2011-01-29 09:41:07 +0100 |
| commit | 80038c3cba2dee9c6c41ab6a28a1233a538ee2ee (patch) | |
| tree | ec2a6ce9c543c59400b62700485a5352a54b369c | |
| parent | copy: factor sparse-copying code into its own function, because (diff) | |
| download | coreutils-80038c3cba2dee9c6c41ab6a28a1233a538ee2ee.tar.gz coreutils-80038c3cba2dee9c6c41ab6a28a1233a538ee2ee.zip | |
copy: remove obsolete comment
* src/copy.c (sparse_copy): Remove now-obsolete comment about
how we used to work around lack of ftruncate. Combine nested
if conditions into one.
| -rw-r--r-- | src/copy.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/copy.c b/src/copy.c index cc8f68f14..4bfdce68b 100644 --- a/src/copy.c +++ b/src/copy.c @@ -137,7 +137,10 @@ utimens_symlink (char const *file, struct timespec const *timespec) /* Copy the regular file open on SRC_FD/SRC_NAME to DST_FD/DST_NAME, honoring the MAKE_HOLES setting and using the BUF_SIZE-byte buffer BUF for temporary storage. Return true upon successful completion; - print a diagnostic and return false upon error. */ + print a diagnostic and return false upon error. + Note that for best results, BUF should be "well"-aligned. + BUF must have sizeof(uintptr_t)-1 bytes of additional space + beyond BUF[BUF_SIZE-1]. */ static bool sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, bool make_holes, @@ -227,18 +230,12 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, } } - /* If the file ends with a `hole', we need to do something to record - the length of the file. On modern systems, calling ftruncate does - the job. On systems without native ftruncate support, we have to - write a byte at the ending position. Otherwise the kernel would - truncate the file at the end of the last write operation. */ - if (last_write_made_hole) + /* If the file ends with a `hole', we need to do something to record the + length of the file. On modern systems, calling ftruncate does the job. */ + if (last_write_made_hole && ftruncate (dest_fd, n_read_total) < 0) { - if (ftruncate (dest_fd, n_read_total) < 0) - { - error (0, errno, _("truncating %s"), quote (dst_name)); - return false; - } + error (0, errno, _("truncating %s"), quote (dst_name)); + return false; } return true; |
