summaryrefslogtreecommitdiff
path: root/src/copy.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-04-09 10:49:38 +0200
committerJim Meyering <meyering@redhat.com>2010-04-09 10:50:43 +0200
commitef5758c3282b3325340d8b601deed5ab5e7ade64 (patch)
tree524d29d97747994b3f3cb1fbbbefbe373cb1c671 /src/copy.c
parent0a9302e7f796bc59a17f85fed00f0350c8330e12 (diff)
downloadcoreutils-ef5758c3282b3325340d8b601deed5ab5e7ade64.tar.xz
maint: ftruncate is always available, even without gnulib
Now that even MinGW provides ftruncate, we know that all reasonable portability targets provide this function. Remove the workaround code. We nearly removed the gnulib module three years ago: http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/9203 and it is now officially "obsolete". * bootstrap.conf (gnulib_modules): Remove ftruncate. * src/copy.c (copy_reg): Remove use of HAVE_FTRUNCATE and its no-longer-used workaround code. * src/truncate.c: Remove a comment about handling missing ftruncate.
Diffstat (limited to 'src/copy.c')
-rw-r--r--src/copy.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/copy.c b/src/copy.c
index 29f37c980..3c32fa311 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -798,15 +798,9 @@ copy_reg (char const *src_name, char const *dst_name,
if (last_write_made_hole)
{
- if (HAVE_FTRUNCATE
- ? /* ftruncate sets the file size,
- so there is no need for a write. */
- ftruncate (dest_desc, n_read_total) < 0
- : /* Seek backwards one character and write a null. */
- (lseek (dest_desc, (off_t) -1, SEEK_CUR) < 0L
- || full_write (dest_desc, "", 1) != 1))
+ if (ftruncate (dest_desc, n_read_total) < 0)
{
- error (0, errno, _("writing %s"), quote (dst_name));
+ error (0, errno, _("truncating %s"), quote (dst_name));
return_val = false;
goto close_src_and_dst_desc;
}