extern int always_checksum;
extern int modify_window;
extern char *compare_dest;
+extern int link_dest;
/* choose whether to skip a particular file */
if (st->st_size != file->length) {
return 0;
}
+ if (link_dest) {
+ if((st->st_mode & ~_S_IFMT) != (file->mode & ~_S_IFMT)) {
+ return 0;
+ }
+ if (st->st_uid != file->uid || st->st_gid != file->gid) {
+ return 0;
+ }
+ }
+
/* if always checksum is set then we use the checksum instead
of the file time to determine whether to sync */
statret = -1;
if (statret == -1)
errno = saveerrno;
+#if HAVE_LINK
+ else if (link_dest && !dry_run) {
+ if (do_link(fnamecmpbuf, fname) != 0) {
+ if (verbose > 0)
+ rprintf(FINFO,"link %s => %s : %s\n",
+ fnamecmpbuf,
+ fname,
+ strerror(errno));
+ }
+ fnamecmp = fnamecmpbuf;
+ }
+#endif
else
fnamecmp = fnamecmpbuf;
}