return 1;
}
+
+#define SID_UPDATING ITEM_UPDATING
+#define SID_REPORT_CHECKSUM ITEM_REPORT_CHECKSUM
+#define SID_NO_DEST_AND_NO_UPDATE (1<<16)
+
+static void itemize(struct file_struct *file, int statret, STRUCT_STAT *st,
+ int32 sflags, int f_out, int ndx)
+{
+ int iflags = sflags & (SID_UPDATING | SID_REPORT_CHECKSUM);
+
+ if (statret >= 0) {
+ if (S_ISREG(file->mode) && file->length != st->st_size)
+ iflags |= ITEM_REPORT_SIZE;
+ } else
+ iflags |= ITEM_IS_NEW;
+ if (statret >= 0 && !(sflags & SID_NO_DEST_AND_NO_UPDATE)) {
+ int keep_time = !preserve_times ? 0
+ : S_ISDIR(file->mode) ? !omit_dir_times : !S_ISLNK(file->mode);
+
+ if ((iflags & ITEM_UPDATING && !keep_time)
+ || (keep_time && file->modtime != st->st_mtime))
+ iflags |= ITEM_REPORT_TIME;
+ if (preserve_perms && file->mode != st->st_mode)
+ iflags |= ITEM_REPORT_PERMS;
+ if (preserve_uid && am_root && file->uid != st->st_uid)
+ iflags |= ITEM_REPORT_OWNER;
+ if (preserve_gid && file->gid != GID_NONE && st->st_gid != file->gid)
+ iflags |= ITEM_REPORT_GROUP;
+ }
+
+ if (iflags && !read_batch) {
+ if (ndx >= 0)
+ write_int(f_out, ndx);
+ write_byte(f_out, iflags);
+ write_byte(f_out, iflags >> 8);
+ }
+}
+
+
/* Perform our quick-check heuristic for determining if a file is unchanged. */
static int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
{
unmap_file(mapbuf);
}
+
/* Try to find a filename in the same dir as "fname" with a similar name. */
static int find_fuzzy(struct file_struct *file, struct file_list *dirlist)
{
missing_below = file->dir.depth;
dry_run++;
}
+ if (protocol_version >= 29 && f_out != -1)
+ itemize(file, statret, &st, 0, f_out, ndx);
if (statret != 0 && do_mkdir(fname,file->mode) != 0 && errno != EEXIST) {
if (!relative_paths || errno != ENOENT
|| create_directory_path(fname, orig_umask) < 0
}
}
if (set_perms(fname, file, statret ? NULL : &st, 0)
- && verbose && f_out != -1)
+ && verbose && protocol_version < 29 && f_out != -1)
rprintf(FINFO, "%s/\n", safe_fname(fname));
if (delete_during && f_out != -1 && csum_length != SUM_LENGTH
&& (file->flags & FLAG_DEL_HERE))
delete_in_dir(flist, fname, file);
return;
- } else if (max_size && file->length > max_size) {
+ }
+
+ if (max_size && file->length > max_size) {
if (verbose > 1) {
rprintf(FINFO, "%s is over max-size\n",
safe_fname(fname));
* right place -- no further action
* required. */
if (strcmp(lnk, file->u.link) == 0) {
+ if (protocol_version >= 29) {
+ itemize(file, 0, &st, 0,
+ f_out, ndx);
+ }
set_perms(fname, file, &st,
PERMS_REPORT);
return;
full_fname(fname), safe_fname(file->u.link));
} else {
set_perms(fname,file,NULL,0);
- if (verbose) {
+ if (protocol_version >= 29) {
+ itemize(file, statret, &st, SID_UPDATING,
+ f_out, ndx);
+ } else if (verbose) {
rprintf(FINFO, "%s -> %s\n", safe_fname(fname),
safe_fname(file->u.link));
}
st.st_mode != file->mode ||
st.st_rdev != file->u.rdev) {
int dflag = S_ISDIR(st.st_mode) ? DEL_DIR : 0;
+ if (protocol_version >= 29) {
+ itemize(file, statret, &st, SID_UPDATING,
+ f_out, ndx);
+ }
delete_file(fname, dflag | DEL_TERSE);
if (verbose > 2) {
rprintf(FINFO,"mknod(%s,0%o,0x%x)\n",
full_fname(fname));
} else {
set_perms(fname,file,NULL,0);
- if (verbose) {
+ if (verbose && protocol_version < 29) {
rprintf(FINFO, "%s\n",
safe_fname(fname));
}
}
} else {
+ if (protocol_version >= 29) {
+ itemize(file, statret, &st, 0,
+ f_out, ndx);
+ }
set_perms(fname, file, &st, PERMS_REPORT);
}
return;
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
- if (statret == -1 && basis_dir[0] != NULL) {
+ if (statret != 0 && basis_dir[0] != NULL) {
int fallback_match = -1;
int match_level = 0;
int i = 0;
if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL
&& link_stat(partialptr, &partial_st, 0) == 0
&& S_ISREG(partial_st.st_mode)) {
- if (statret == -1)
+ if (statret != 0)
goto prepare_to_open;
} else
partialptr = NULL;
- if (statret == -1 && fuzzy_basis && dry_run <= 1) {
+ if (statret != 0 && fuzzy_basis && dry_run <= 1) {
int j = find_fuzzy(file, fuzzy_dirlist);
if (j >= 0) {
fuzzy_file = fuzzy_dirlist->files[j];
}
}
- if (statret == -1) {
+ if (statret != 0) {
if (preserve_hard_links && hard_link_check(file, HL_SKIP))
return;
if (stat_errno == ENOENT)
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
else if (unchanged_file(fnamecmp, file, &st)) {
+ if (protocol_version >= 29) {
+ itemize(file, statret, &st,
+ fnamecmp_type == FNAMECMP_FNAME
+ ? 0 : SID_NO_DEST_AND_NO_UPDATE,
+ f_out, ndx);
+ }
if (fnamecmp_type == FNAMECMP_FNAME)
set_perms(fname, file, &st, PERMS_REPORT);
return;
if (dry_run || read_batch)
goto notify_others;
if (whole_file > 0) {
- statret = -1;
+ if (statret == 0)
+ statret = 1;
goto notify_others;
}
notify_others:
write_int(f_out, ndx);
- if (protocol_version >= 29 && inplace && !read_batch)
- write_byte(f_out, fnamecmp_type);
+ if (protocol_version >= 29) {
+ itemize(file, statret, &st, SID_UPDATING
+ | (always_checksum ? SID_REPORT_CHECKSUM : 0),
+ f_out, -1);
+ if (inplace && !read_batch)
+ write_byte(f_out, fnamecmp_type);
+ }
if (f_out_name >= 0) {
write_byte(f_out_name, fnamecmp_type);
if (fnamecmp_type == FNAMECMP_FUZZY) {