+ if ((preserve_devices && IS_DEVICE(mode))
+ || (preserve_specials && IS_SPECIAL(mode))) {
+ uint32 *devp = F_RDEV_P(file);
+ DEV_MAJOR(devp) = major(rdev);
+ DEV_MINOR(devp) = minor(rdev);
+ }
+
+#ifdef SUPPORT_LINKS
+ if (linkname_len) {
+ bp = (char*)file->basename + basename_len;
+ if (first_hlink_ndx >= 0) {
+ struct file_struct *first = flist->files[first_hlink_ndx];
+ memcpy(bp, F_SYMLINK(first), linkname_len);
+ } else
+ read_sbuf(f, bp, linkname_len - 1);
+ if (sanitize_paths)
+ sanitize_path(bp, bp, "", lastdir_depth, NULL);
+ }
+#endif
+
+#ifdef SUPPORT_HARD_LINKS
+ if (preserve_hard_links && flags & XMIT_HLINKED) {
+ if (protocol_version >= 30) {
+ F_HL_GNUM(file) = flags & XMIT_HLINK_FIRST
+ ? flist->count : first_hlink_ndx;
+ } else {
+ static int32 cnt = 0;
+ struct idev_node *np;
+ int64 ino;
+ int32 ndx;
+ if (protocol_version < 26) {
+ dev = read_int(f);
+ ino = read_int(f);
+ } else {
+ if (!(flags & XMIT_SAME_DEV_pre30))
+ dev = read_longint(f);
+ ino = read_longint(f);
+ }
+ np = idev_node(dev, ino);
+ ndx = (int32)np->data - 1;
+ if (ndx < 0) {
+ ndx = cnt++;
+ np->data = (void*)cnt;
+ }
+ F_HL_GNUM(file) = ndx;
+ }
+ }
+#endif
+
+ if (always_checksum && (S_ISREG(mode) || protocol_version < 28)) {
+ if (S_ISREG(mode))
+ bp = (char*)F_SUM(file);
+ else {
+ /* Prior to 28, we get a useless set of nulls. */
+ bp = tmp_sum;
+ }
+ if (first_hlink_ndx >= 0) {
+ struct file_struct *first = flist->files[first_hlink_ndx];
+ memcpy(bp, F_SUM(first), checksum_len);
+ } else
+ read_buf(f, bp, checksum_len);
+ }