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;
}
This is backwards compatible with the FreeBSD utility, but is more
flexible wrt the size specifications and the use of long options,
- to better fit the "GNU" environment.
-
- Note if !defined(HAVE_FTRUNCATE) then the --skip-ftruncate configure flag
- was specified or we're in a mingw environment. In these cases gnulib
- emulation will be used and GNULIB_FTRUNCATE is defined. Note if emulation
- can't even be provided ftruncate() will return EIO. */
+ to better fit the "GNU" environment. */
#include <config.h> /* sets _FILE_OFFSET_BITS=64 etc. */
#include <stdio.h>