produce an invalid copy on the destination device.
(copy_reg): Even with --sparse=always, try to
make `holes' only if the destination is a regular file.
Reported by Szakacsits Szabolcs.
int return_val = 0;
off_t n_read_total = 0;
int last_write_made_hole = 0;
- int make_holes = (x->sparse_mode == SPARSE_ALWAYS);
+ int make_holes = 0;
source_desc = open (src_path, O_RDONLY);
if (source_desc < 0)
buf_size = ST_BLKSIZE (sb);
+ /* Even with --sparse=always, try to create holes only
+ if the destination is a regular file. */
+ if (x->sparse_mode == SPARSE_ALWAYS && S_ISREG (sb.st_mode))
+ make_holes = 1;
+
#if HAVE_STRUCT_STAT_ST_BLOCKS
if (x->sparse_mode == SPARSE_AUTO && S_ISREG (sb.st_mode))
{