-#define STRDUP(ap, p) (ap ? string_area_strdup(ap, p) : strdup(p))
-/* IRIX cc cares that the operands to the ternary have the same type. */
-#define MALLOC(ap, i) (ap ? (void*) string_area_malloc(ap, i) : malloc(i))
+#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 {
+ struct idev *idevp = pool_talloc(hlink_pool, struct idev,
+ 1, "inode_table");
+ F_HL_IDEV(file) = idevp;
+ if (protocol_version < 26) {
+ idevp->dev = read_int(f);
+ idevp->ino = read_int(f);
+ } else {
+ if (!(flags & XMIT_SAME_DEV_pre30))
+ dev = read_longint(f);
+ idevp->dev = dev;
+ idevp->ino = read_longint(f);
+ }
+ }
+ }
+#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);
+ }
+
+ return file;
+}