Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
288b12e
)
Handle inheritance of SGID bit on dirs marked with FLAG_DIR_CREATED.
author
Wayne Davison
<wayned@samba.org>
Sat, 15 Sep 2007 19:58:15 +0000
(19:58 +0000)
committer
Wayne Davison
<wayned@samba.org>
Sat, 15 Sep 2007 19:58:15 +0000
(19:58 +0000)
rsync.c
patch
|
blob
|
blame
|
history
diff --git
a/rsync.c
b/rsync.c
index
5d09fd3
..
4f387d6
100644
(file)
--- a/
rsync.c
+++ b/
rsync.c
@@
-274,6
+274,7
@@
int set_file_attrs(const char *fname, struct file_struct *file, statx *sxp,
statx sx2;
int change_uid, change_gid;
mode_t new_mode = file->mode;
statx sx2;
int change_uid, change_gid;
mode_t new_mode = file->mode;
+ int inherit;
if (!sxp) {
if (dry_run)
if (!sxp) {
if (dry_run)
@@
-289,13
+290,15
@@
int set_file_attrs(const char *fname, struct file_struct *file, statx *sxp,
#ifdef SUPPORT_XATTRS
sx2.xattr = NULL;
#endif
#ifdef SUPPORT_XATTRS
sx2.xattr = NULL;
#endif
- if (!preserve_perms && S_ISDIR(new_mode)
- && sx2.st.st_mode & S_ISGID) {
- /* We just created this directory and its setgid
- * bit is on, so make sure it stays on. */
- new_mode |= S_ISGID;
- }
sxp = &sx2;
sxp = &sx2;
+ inherit = !preserve_perms;
+ } else
+ inherit = !preserve_perms && file->flags & FLAG_DIR_CREATED;
+
+ if (inherit && S_ISDIR(new_mode) && sxp->st.st_mode & S_ISGID) {
+ /* We just created this directory and its setgid
+ * bit is on, so make sure it stays on. */
+ new_mode |= S_ISGID;
}
#ifdef SUPPORT_ACLS
}
#ifdef SUPPORT_ACLS