extern int preserve_gid;
extern int preserve_times;
extern int omit_dir_times;
+extern int delete_mode;
extern int delete_before;
extern int delete_during;
extern int delete_after;
return -1;
}
- zap_dir = flags & DEL_FORCE_RECURSE || (force_delete && recurse);
+ zap_dir = flags & DEL_FORCE_RECURSE || force_delete;
if ((max_delete && ++deletion_count > max_delete)
|| (dry_run && zap_dir)) {
ok = 0;
iflags |= ITEM_REPORT_SIZE;
if ((iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
&& (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
- || (keep_time && cmp_modtime(file->modtime, st->st_mtime) != 0))
+ || (keep_time && cmp_time(file->modtime, st->st_mtime) != 0))
iflags |= ITEM_REPORT_TIME;
- if (preserve_perms
- && (file->mode & CHMOD_BITS) != (st->st_mode & CHMOD_BITS))
+ if ((file->mode & CHMOD_BITS) != (st->st_mode & CHMOD_BITS))
iflags |= ITEM_REPORT_PERMS;
if (preserve_uid && am_root && file->uid != st->st_uid)
iflags |= ITEM_REPORT_OWNER;
if (ignore_times)
return 0;
- return cmp_modtime(st->st_mtime, file->modtime) == 0;
+ return cmp_time(st->st_mtime, file->modtime) == 0;
}
name = fp->basename;
if (fp->length == file->length
- && cmp_modtime(fp->modtime, file->modtime) == 0) {
+ && cmp_time(fp->modtime, file->modtime) == 0) {
if (verbose > 4) {
rprintf(FINFO,
"fuzzy size/modtime match for %s\n",
if (!unchanged_attrs(file, stp))
continue;
if ((always_checksum || ignore_times)
- && cmp_modtime(stp->st_mtime, file->modtime))
+ && cmp_time(stp->st_mtime, file->modtime))
continue;
best_match = j;
match_level = 3;
char *fnamecmp, *partialptr, *backupptr = NULL;
char fnamecmpbuf[MAXPATHLEN];
uchar fnamecmp_type;
- int del_opts = DEL_TERSE | (delete_after ? DEL_FORCE_RECURSE : 0);
+ int del_opts = DEL_TERSE | (delete_mode ? DEL_FORCE_RECURSE : 0);
if (list_only)
return;
return;
}
- if (statret == 0 && !preserve_perms
- && S_ISDIR(st.st_mode) == S_ISDIR(file->mode)) {
- /* if the file exists already and we aren't perserving
- * permissions then act as though the remote end sent
- * us the file permissions we already have */
- file->mode = (file->mode & ~CHMOD_BITS)
- | (st.st_mode & CHMOD_BITS);
+ /* If we're not preserving permissions, change the file-list's
+ * mode based on the local permissions and some heuristics. */
+ if (!preserve_perms) {
+ int exists = statret == 0
+ && S_ISDIR(st.st_mode) == S_ISDIR(file->mode);
+ file->mode = dest_mode(file->mode, st.st_mode, exists);
}
if (S_ISDIR(file->mode)) {
}
if (update_only && statret == 0
- && cmp_modtime(st.st_mtime, file->modtime) > 0) {
+ && cmp_time(st.st_mtime, file->modtime) > 0) {
if (verbose > 1)
rprintf(FINFO, "%s is newer\n", fname);
return;