diff options
author | Wayne Davison <wayned@samba.org> | 2009-04-10 16:22:44 -0700 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2009-04-10 16:22:44 -0700 |
commit | cb197514d99d17dc3a1ce26ff8918d63307d75e4 (patch) | |
tree | b92675696b2098f54d46c0fec4383897acfb184d /backup.c | |
parent | a055dbdd883a3c04318e13211c3ef7942314bee7 (diff) | |
download | android_external_rsync-cb197514d99d17dc3a1ce26ff8918d63307d75e4.tar.gz android_external_rsync-cb197514d99d17dc3a1ce26ff8918d63307d75e4.tar.bz2 android_external_rsync-cb197514d99d17dc3a1ce26ff8918d63307d75e4.zip |
Fixed an ACL/xattr corruption issue where the --backup option could cause
rsync to associate the wrong ACL/xattr information with received files.
Diffstat (limited to 'backup.c')
-rw-r--r-- | backup.c | 32 |
1 files changed, 28 insertions, 4 deletions
@@ -106,19 +106,25 @@ int make_bak_dir(const char *fullpath) #ifdef SUPPORT_ACLS if (preserve_acls && !S_ISLNK(file->mode)) { get_acl(rel, &sx); - cache_acl(file, &sx); + cache_tmp_acl(file, &sx); free_acl(&sx); } #endif #ifdef SUPPORT_XATTRS if (preserve_xattrs) { get_xattr(rel, &sx); - cache_xattr(file, &sx); + cache_tmp_xattr(file, &sx); free_xattr(&sx); } #endif set_file_attrs(fbuf, file, NULL, NULL, 0); unmake_file(file); +#ifdef SUPPORT_ACLS + uncache_tmp_acls(); +#endif +#ifdef SUPPORT_XATTRS + uncache_tmp_xattrs(); +#endif } } *p = '/'; @@ -219,14 +225,14 @@ int make_backup(const char *fname, BOOL prefer_rename) #ifdef SUPPORT_ACLS if (preserve_acls && !S_ISLNK(file->mode)) { get_acl(fname, &sx); - cache_acl(file, &sx); + cache_tmp_acl(file, &sx); free_acl(&sx); } #endif #ifdef SUPPORT_XATTRS if (preserve_xattrs) { get_xattr(fname, &sx); - cache_xattr(file, &sx); + cache_tmp_xattr(file, &sx); free_xattr(&sx); } #endif @@ -313,6 +319,12 @@ int make_backup(const char *fname, BOOL prefer_rename) rprintf(FINFO, "make_bak: skipping non-regular file %s\n", fname); unmake_file(file); +#ifdef SUPPORT_ACLS + uncache_tmp_acls(); +#endif +#ifdef SUPPORT_XATTRS + uncache_tmp_xattrs(); +#endif return 2; } @@ -322,6 +334,12 @@ int make_backup(const char *fname, BOOL prefer_rename) rsyserr(FERROR, errno, "keep_backup failed: %s -> \"%s\"", full_fname(fname), buf); unmake_file(file); +#ifdef SUPPORT_ACLS + uncache_tmp_acls(); +#endif +#ifdef SUPPORT_XATTRS + uncache_tmp_xattrs(); +#endif return 0; } ret = 2; @@ -333,6 +351,12 @@ int make_backup(const char *fname, BOOL prefer_rename) preserve_xattrs = save_preserve_xattrs; unmake_file(file); +#ifdef SUPPORT_ACLS + uncache_tmp_acls(); +#endif +#ifdef SUPPORT_XATTRS + uncache_tmp_xattrs(); +#endif success: if (INFO_GTE(BACKUP, 1)) { |