From: Wayne Davison Date: Sat, 5 Sep 2009 15:16:22 +0000 (-0700) Subject: Avoid an dry-run error trying to stat a prior hard-link X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/b15fa9bd7bf3a379ab03eead92701cff42cdaa13 Avoid an dry-run error trying to stat a prior hard-link file that hasn't really been created. --- diff --git a/hlink.c b/hlink.c index 291c5cea..70f9d8c6 100644 --- a/hlink.c +++ b/hlink.c @@ -377,9 +377,13 @@ int hard_link_check(struct file_struct *file, int ndx, char *fname, } if (link_stat(prev_name, &prev_st, 0) < 0) { - rsyserr(FERROR_XFER, errno, "stat %s failed", - full_fname(prev_name)); - return -1; + if (!dry_run || errno != ENOENT) { + rsyserr(FERROR_XFER, errno, "stat %s failed", full_fname(prev_name)); + return -1; + } + /* A new hard-link will get a new dev & inode, so approximate + * those values in dry-run mode by zeroing them. */ + memset(&prev_st, 0, sizeof prev_st); } if (statret < 0 && basis_dir[0] != NULL) {