diff options
author | Wayne Davison <wayned@samba.org> | 2005-07-27 23:30:58 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2005-07-27 23:30:58 +0000 |
commit | c8d3465726b7990ecfd217c633939b90b03944cb (patch) | |
tree | 31b08d842b6a86db302696b9abc7ac55866390a4 | |
parent | 00b9618460c40131a8925047853f73ccbe9fc20b (diff) | |
download | rsync-c8d3465726b7990ecfd217c633939b90b03944cb.tar.gz |
- 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.
-rw-r--r-- | rsync.c | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -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 |