+ if ((basename = strrchr(thisname, '/')) != NULL) {
+ dirname_len = ++basename - thisname; /* counts future '\0' */
+ if (lastdir_len == dirname_len - 1
+ && strncmp(thisname, lastdir, lastdir_len) == 0) {
+ dirname = lastdir;
+ dirname_len = 0; /* indicates no copy is needed */
+ } else
+ dirname = thisname;
+ } else {
+ basename = thisname;
+ dirname = NULL;
+ dirname_len = 0;
+ }
+ basename_len = strlen(basename) + 1; /* count the '\0' */
+
+#ifdef SUPPORT_HARD_LINKS
+ if (protocol_version >= 30
+ && BITS_SETnUNSET(flags, XMIT_HLINKED, XMIT_HLINK_FIRST)) {
+ struct file_struct *first;
+ first_hlink_ndx = read_int(f);
+ if (first_hlink_ndx < 0 || first_hlink_ndx >= flist->count) {
+ rprintf(FERROR,
+ "hard-link reference out of range: %d (%d)\n",
+ first_hlink_ndx, flist->count);
+ exit_cleanup(RERR_PROTOCOL);
+ }
+ first = flist->files[first_hlink_ndx];
+ file_length = F_LENGTH(first);
+ modtime = first->modtime;
+ mode = first->mode;
+ if (preserve_uid)
+ uid = F_UID(first);
+ if (preserve_gid)
+ gid = F_GID(first);
+ if ((preserve_devices && IS_DEVICE(mode))
+ || (preserve_specials && IS_SPECIAL(mode))) {
+ uint32 *devp = F_RDEV_P(first);
+ rdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
+ }
+ if (preserve_links && S_ISLNK(mode))
+ linkname_len = strlen(F_SYMLINK(first)) + 1;
+ else
+ linkname_len = 0;
+ goto create_object;