From c8d3465726b7990ecfd217c633939b90b03944cb Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 27 Jul 2005 23:30:58 +0000 Subject: [PATCH] - Call set_modtime() with its new mode arg. - Don't mask the mode bits being sent to do_chmod(). - Don't skip calling set_modtime() or do_chmod() when the item is a symlink. --- rsync.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/rsync.c b/rsync.c index ca21e5e4..6d2812c5 100644 --- a/rsync.c +++ b/rsync.c @@ -68,17 +68,18 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st, st = &st2; } - if (!preserve_times || S_ISLNK(st->st_mode) - || (S_ISDIR(st->st_mode) && omit_dir_times)) + if (!preserve_times || (S_ISDIR(st->st_mode) && omit_dir_times)) flags |= PERMS_SKIP_MTIME; if (!(flags & PERMS_SKIP_MTIME) && cmp_modtime(st->st_mtime, file->modtime) != 0) { - if (set_modtime(fname,file->modtime) != 0) { + int ret = set_modtime(fname, file->modtime, st->st_mode); + if (ret < 0) { rsyserr(FERROR, errno, "failed to set times on %s", full_fname(fname)); return 0; } - updated = 1; + if (ret == 0) /* ret == 1 if symlink could not be set */ + updated = 1; } change_uid = am_root && preserve_uid && st->st_uid != file->uid; @@ -125,15 +126,16 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st, } #ifdef HAVE_CHMOD - if (!S_ISLNK(st->st_mode)) { - if ((st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) { - updated = 1; - if (do_chmod(fname,(file->mode & CHMOD_BITS)) != 0) { - rsyserr(FERROR, errno, "failed to set permissions on %s", - full_fname(fname)); - return 0; - } + if ((st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) { + int ret = do_chmod(fname, file->mode); + if (ret < 0) { + rsyserr(FERROR, errno, + "failed to set permissions on %s", + full_fname(fname)); + return 0; } + if (ret == 0) /* ret == 1 if symlink could not be set */ + updated = 1; } #endif -- 2.34.1