summaryrefslogtreecommitdiff
path: root/flist.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-03-28 10:30:19 -0700
committerWayne Davison <wayned@samba.org>2008-03-28 10:40:10 -0700
commitfd2598022cc10ce4f28019f5c0cb1816cd9311a4 (patch)
treeb363c7e1d2dc42e495a396382f655fbe4eeffaa8 /flist.c
parentb05c58cce6afb65c15400dcd9fc6041c9182aad8 (diff)
downloadrsync-fd2598022cc10ce4f28019f5c0cb1816cd9311a4.tar.gz
Allow the file-list sending code to set XMIT_SAME_UID/XMIT_SAME_GID
when owner/group info isn't being preserved. This helps to ensure that the lower 8 bits of the xflags aren't 0, and is what older rsync versions did.
Diffstat (limited to 'flist.c')
-rw-r--r--flist.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/flist.c b/flist.c
index 673148e7..eca0dc7b 100644
--- a/flist.c
+++ b/flist.c
@@ -429,28 +429,24 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
}
} else if (protocol_version < 28)
rdev = MAKEDEV(0, 0);
- if (preserve_uid) {
- if ((uid_t)F_OWNER(file) == uid && *lastname)
- xflags |= XMIT_SAME_UID;
- else {
- uid = F_OWNER(file);
- if (!numeric_ids) {
- user_name = add_uid(uid);
- if (inc_recurse && user_name)
- xflags |= XMIT_USER_NAME_FOLLOWS;
- }
+ if (!preserve_uid || ((uid_t)F_OWNER(file) == uid && *lastname))
+ xflags |= XMIT_SAME_UID;
+ else {
+ uid = F_OWNER(file);
+ if (!numeric_ids) {
+ user_name = add_uid(uid);
+ if (inc_recurse && user_name)
+ xflags |= XMIT_USER_NAME_FOLLOWS;
}
}
- if (preserve_gid) {
- if ((gid_t)F_GROUP(file) == gid && *lastname)
- xflags |= XMIT_SAME_GID;
- else {
- gid = F_GROUP(file);
- if (!numeric_ids) {
- group_name = add_gid(gid);
- if (inc_recurse && group_name)
- xflags |= XMIT_GROUP_NAME_FOLLOWS;
- }
+ if (!preserve_gid || ((gid_t)F_GROUP(file) == gid && *lastname))
+ xflags |= XMIT_SAME_GID;
+ else {
+ gid = F_GROUP(file);
+ if (!numeric_ids) {
+ group_name = add_gid(gid);
+ if (inc_recurse && group_name)
+ xflags |= XMIT_GROUP_NAME_FOLLOWS;
}
}
if (file->modtime == modtime)
@@ -467,15 +463,14 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
np->data = (void*)(long)(first_ndx + ndx + 1);
xflags |= XMIT_HLINK_FIRST;
}
- xflags |= XMIT_HLINKED;
} else {
if (tmp_dev == dev) {
if (protocol_version >= 28)
xflags |= XMIT_SAME_DEV_pre30;
} else
dev = tmp_dev;
- xflags |= XMIT_HLINKED;
}
+ xflags |= XMIT_HLINKED;
}
#endif