extern int verbose;
extern int dry_run;
+extern int list_only;
extern int am_sender;
extern int inc_recurse;
extern int do_xfers;
extern int remove_source_files;
extern int stdout_format_has_i;
extern int maybe_ATTRS_REPORT;
+extern int unsort_ndx;
extern char *basis_dir[];
extern struct file_list *cur_flist;
-#ifdef ICONV_OPTION
-extern int ic_ndx;
-#endif
#ifdef SUPPORT_HARD_LINKS
if (gnum != gnum_next)
break;
F_HL_PREV(file) = prev;
- /* The linked list must use raw ndx values. */
-#ifdef ICONV_OPTION
- if (ic_ndx)
+ /* The linked list uses over-the-wire ndx values. */
+ if (unsort_ndx)
prev = F_NDX(file);
else
-#endif
prev = ndx_list[from] + hlink_flist->ndx_start;
}
if (prev < 0 && !inc_recurse) {
file->flags |= FLAG_HLINK_LAST;
F_HL_PREV(file) = prev;
if (inc_recurse && CVAL(node->data, 0) == 0) {
-#ifdef ICONV_OPTION
- if (ic_ndx)
+ if (unsort_ndx)
prev = F_NDX(file);
else
-#endif
prev = ndx_list[from] + hlink_flist->ndx_start;
SIVAL(node->data, 1, prev);
}
* to first when we're done. */
void match_hard_links(struct file_list *flist)
{
- int i, ndx_count = 0;
- int32 *ndx_list;
+ if (!list_only) {
+ int i, ndx_count = 0;
+ int32 *ndx_list;
- if (!(ndx_list = new_array(int32, flist->used)))
- out_of_memory("match_hard_links");
+ if (!(ndx_list = new_array(int32, flist->used)))
+ out_of_memory("match_hard_links");
- for (i = 0; i < flist->used; i++) {
- if (F_IS_HLINKED(flist->sorted[i]))
- ndx_list[ndx_count++] = i;
- }
+ for (i = 0; i < flist->used; i++) {
+ if (F_IS_HLINKED(flist->sorted[i]))
+ ndx_list[ndx_count++] = i;
+ }
- hlink_flist = flist;
+ hlink_flist = flist;
- if (ndx_count)
- match_gnums(ndx_list, ndx_count);
+ if (ndx_count)
+ match_gnums(ndx_list, ndx_count);
- free(ndx_list);
+ free(ndx_list);
+ }
if (protocol_version < 30)
idev_destroy();
}
if (!make_backup(fname))
return -1;
} else if (robust_unlink(fname)) {
- rsyserr(FERROR, errno, "unlink %s failed",
+ rsyserr(FERROR_XFER, errno, "unlink %s failed",
full_fname(fname));
return -1;
}
if (!prev_name) {
struct file_struct *prev_file = flist->files[prev_ndx - flist->ndx_start];
- /* Is the previous link is not complete yet? */
+ /* Is the previous link not complete yet? */
if (!(prev_file->flags & FLAG_HLINK_DONE)) {
/* Is the previous link being transferred? */
if (prev_file->flags & FLAG_FILE_SENT) {
- /* Add ourselves to the list of files that will be
- * updated when the transfer completes, and mark
- * ourself as waiting for the transfer. */
+ /* Add ourselves to the list of files that will
+ * be updated when the transfer completes, and
+ * mark ourself as waiting for the transfer. */
F_HL_PREV(file) = F_HL_PREV(prev_file);
F_HL_PREV(prev_file) = ndx;
file->flags |= FLAG_FILE_SENT;
}
if (link_stat(prev_name, &prev_st, 0) < 0) {
- rsyserr(FERROR, errno, "stat %s failed",
+ rsyserr(FERROR_XFER, errno, "stat %s failed",
full_fname(prev_name));
return -1;
}
|| prev_st.st_ino != alt_sx.st.st_ino)
continue;
statret = 1;
- if (verbose < 2 || !stdout_format_has_i) {
+ if (stdout_format_has_i == 0
+ || (verbose < 2 && stdout_format_has_i < 2)) {
itemizing = 0;
code = FNONE;
if (verbose > 1 && maybe_ATTRS_REPORT)
enum logcode code;
if (terse) {
if (!verbose)
- return -1;
+ return 0;
code = FINFO;
} else
- code = FERROR;
+ code = FERROR_XFER;
rsyserr(code, errno, "link %s => %s failed",
full_fname(fname), oldname);
return 0;
if (stp == NULL && prev_ndx >= 0) {
if (link_stat(fname, &st, 0) < 0) {
- rsyserr(FERROR, errno, "stat %s failed",
+ rsyserr(FERROR_XFER, errno, "stat %s failed",
full_fname(fname));
return;
}