- Made recv_file_entry() name the xmit-flags variable "xflags" to
prevent confusion with the internal flags value we're creating.
- Added an arg to the calls of recv_group_name() and match_gid().
- Use the improved function names: send_id_list() and recv_id_list().
- Improved the display of the GID values in output_flist().
} else if (protocol_version < 28)
rdev = MAKEDEV(0, 0);
if (preserve_uid) {
} else if (protocol_version < 28)
rdev = MAKEDEV(0, 0);
if (preserve_uid) {
- if (F_UID(file) == uid && *lastname)
+ if (F_OWNER(file) == uid && *lastname)
flags |= XMIT_SAME_UID;
else {
flags |= XMIT_SAME_UID;
else {
if (preserve_uid && !numeric_ids) {
user_name = add_uid(uid);
if (inc_recurse && user_name)
if (preserve_uid && !numeric_ids) {
user_name = add_uid(uid);
if (inc_recurse && user_name)
- if (F_GID(file) == gid && *lastname)
+ if (F_GROUP(file) == gid && *lastname)
flags |= XMIT_SAME_GID;
else {
flags |= XMIT_SAME_GID;
else {
if (preserve_gid && !numeric_ids) {
group_name = add_gid(gid);
if (inc_recurse && group_name)
if (preserve_gid && !numeric_ids) {
group_name = add_gid(gid);
if (inc_recurse && group_name)
}
static struct file_struct *recv_file_entry(struct file_list *flist,
}
static struct file_struct *recv_file_entry(struct file_list *flist,
{
static int64 modtime;
static mode_t mode;
{
static int64 modtime;
static mode_t mode;
struct file_struct *file;
alloc_pool_t *pool;
char *bp;
struct file_struct *file;
alloc_pool_t *pool;
char *bp;
- if (flags & XMIT_SAME_NAME)
+ if (xflags & XMIT_SAME_NAME)
- if (flags & XMIT_LONG_NAME)
+ if (xflags & XMIT_LONG_NAME)
l2 = read_varint30(f);
else
l2 = read_byte(f);
if (l2 >= MAXPATHLEN - l1) {
rprintf(FERROR,
l2 = read_varint30(f);
else
l2 = read_byte(f);
if (l2 >= MAXPATHLEN - l1) {
rprintf(FERROR,
- "overflow: flags=0x%x l1=%d l2=%d lastname=%s [%s]\n",
- flags, l1, l2, lastname, who_am_i());
+ "overflow: xflags=0x%x l1=%d l2=%d lastname=%s [%s]\n",
+ xflags, l1, l2, lastname, who_am_i());
overflow_exit("recv_file_entry");
}
overflow_exit("recv_file_entry");
}
#ifdef SUPPORT_HARD_LINKS
if (protocol_version >= 30
#ifdef SUPPORT_HARD_LINKS
if (protocol_version >= 30
- && BITS_SETnUNSET(flags, XMIT_HLINKED, XMIT_HLINK_FIRST)) {
+ && BITS_SETnUNSET(xflags, XMIT_HLINKED, XMIT_HLINK_FIRST)) {
struct file_struct *first;
first_hlink_ndx = read_varint30(f);
if (first_hlink_ndx < 0 || first_hlink_ndx >= flist->count) {
struct file_struct *first;
first_hlink_ndx = read_varint30(f);
if (first_hlink_ndx < 0 || first_hlink_ndx >= flist->count) {
modtime = first->modtime;
mode = first->mode;
if (preserve_uid)
modtime = first->modtime;
mode = first->mode;
if (preserve_uid)
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
uint32 *devp = F_RDEV_P(first);
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
uint32 *devp = F_RDEV_P(first);
#endif
file_length = read_varlong30(f, 3);
#endif
file_length = read_varlong30(f, 3);
- if (!(flags & XMIT_SAME_TIME)) {
+ if (!(xflags & XMIT_SAME_TIME)) {
if (protocol_version >= 30) {
modtime = read_varlong(f, 4);
#if SIZEOF_TIME_T < SIZEOF_INT64
if (protocol_version >= 30) {
modtime = read_varlong(f, 4);
#if SIZEOF_TIME_T < SIZEOF_INT64
} else
modtime = read_int(f);
}
} else
modtime = read_int(f);
}
- if (!(flags & XMIT_SAME_MODE))
+ if (!(xflags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (chmod_modes && !S_ISLNK(mode))
mode = tweak_mode(mode, chmod_modes);
mode = from_wire_mode(read_int(f));
if (chmod_modes && !S_ISLNK(mode))
mode = tweak_mode(mode, chmod_modes);
- if (preserve_uid && !(flags & XMIT_SAME_UID)) {
+ if (preserve_uid && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
uid = (uid_t)read_int(f);
else {
uid = (uid_t)read_varint(f);
if (protocol_version < 30)
uid = (uid_t)read_int(f);
else {
uid = (uid_t)read_varint(f);
- if (flags & XMIT_USER_NAME_FOLLOWS)
+ if (xflags & XMIT_USER_NAME_FOLLOWS)
uid = recv_user_name(f, uid);
else if (inc_recurse && am_root && !numeric_ids)
uid = match_uid(uid);
}
}
uid = recv_user_name(f, uid);
else if (inc_recurse && am_root && !numeric_ids)
uid = match_uid(uid);
}
}
- if (preserve_gid && !(flags & XMIT_SAME_GID)) {
+ if (preserve_gid && !(xflags & XMIT_SAME_GID)) {
if (protocol_version < 30)
gid = (gid_t)read_int(f);
else {
gid = (gid_t)read_varint(f);
if (protocol_version < 30)
gid = (gid_t)read_int(f);
else {
gid = (gid_t)read_varint(f);
- if (flags & XMIT_GROUP_NAME_FOLLOWS)
- gid = recv_group_name(f, gid);
+ if (xflags & XMIT_GROUP_NAME_FOLLOWS)
+ gid = recv_group_name(f, gid, &new_flags);
else if (inc_recurse && (!am_root || !numeric_ids))
else if (inc_recurse && (!am_root || !numeric_ids))
+ gid = match_gid(gid, &new_flags);
}
}
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
if (protocol_version < 28) {
}
}
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
if (protocol_version < 28) {
- if (!(flags & XMIT_SAME_RDEV_pre28))
+ if (!(xflags & XMIT_SAME_RDEV_pre28))
rdev = (dev_t)read_int(f);
} else {
uint32 rdev_minor;
rdev = (dev_t)read_int(f);
} else {
uint32 rdev_minor;
- if (!(flags & XMIT_SAME_RDEV_MAJOR))
+ if (!(xflags & XMIT_SAME_RDEV_MAJOR))
rdev_major = read_varint30(f);
if (protocol_version >= 30)
rdev_minor = read_varint(f);
rdev_major = read_varint30(f);
if (protocol_version >= 30)
rdev_minor = read_varint(f);
- else if (flags & XMIT_RDEV_MINOR_8_pre30)
+ else if (xflags & XMIT_RDEV_MINOR_8_pre30)
rdev_minor = read_byte(f);
else
rdev_minor = read_int(f);
rdev_minor = read_byte(f);
else
rdev_minor = read_int(f);
create_object:
if (preserve_hard_links) {
if (protocol_version < 28 && S_ISREG(mode))
create_object:
if (preserve_hard_links) {
if (protocol_version < 28 && S_ISREG(mode))
- flags |= XMIT_HLINKED;
- if (flags & XMIT_HLINKED)
+ xflags |= XMIT_HLINKED;
+ if (xflags & XMIT_HLINKED) {
+ new_flags |= FLAG_HLINKED;
+ }
memcpy(bp, basename, basename_len);
bp += basename_len + linkname_len; /* skip space for symlink too */
memcpy(bp, basename, basename_len);
bp += basename_len + linkname_len; /* skip space for symlink too */
-#ifdef SUPPORT_HARD_LINKS
- if (flags & XMIT_HLINKED)
- file->flags |= FLAG_HLINKED;
-#endif
+ file->flags = new_flags;
file->modtime = (time_t)modtime;
file->len32 = (uint32)file_length;
if (file_length > 0xFFFFFFFFu && S_ISREG(mode)) {
file->modtime = (time_t)modtime;
file->len32 = (uint32)file_length;
if (file_length > 0xFFFFFFFFu && S_ISREG(mode)) {
if (S_ISDIR(mode)) {
if (basename_len == 1+1 && *basename == '.') /* +1 for '\0' */
F_DEPTH(file)--;
if (S_ISDIR(mode)) {
if (basename_len == 1+1 && *basename == '.') /* +1 for '\0' */
F_DEPTH(file)--;
- if (flags & XMIT_TOP_DIR) {
+ if (xflags & XMIT_TOP_DIR) {
in_del_hier = recurse;
del_hier_name_len = F_DEPTH(file) == 0 ? 0 : l1 + l2;
if (relative_paths && del_hier_name_len > 2
in_del_hier = recurse;
del_hier_name_len = F_DEPTH(file) == 0 ? 0 : l1 + l2;
if (relative_paths && del_hier_name_len > 2
#endif
#ifdef SUPPORT_HARD_LINKS
#endif
#ifdef SUPPORT_HARD_LINKS
- if (preserve_hard_links && flags & XMIT_HLINKED) {
+ if (preserve_hard_links && xflags & XMIT_HLINKED) {
if (protocol_version >= 30) {
if (protocol_version >= 30) {
- F_HL_GNUM(file) = flags & XMIT_HLINK_FIRST
+ F_HL_GNUM(file) = xflags & XMIT_HLINK_FIRST
? flist->count : first_hlink_ndx;
} else {
static int32 cnt = 0;
? flist->count : first_hlink_ndx;
} else {
static int32 cnt = 0;
dev = read_int(f);
ino = read_int(f);
} else {
dev = read_int(f);
ino = read_int(f);
} else {
- if (!(flags & XMIT_SAME_DEV_pre30))
+ if (!(xflags & XMIT_SAME_DEV_pre30))
dev = read_longint(f);
ino = read_longint(f);
}
dev = read_longint(f);
ino = read_longint(f);
}
file_total += flist->count;
if (!numeric_ids && !inc_recurse)
file_total += flist->count;
if (!numeric_ids && !inc_recurse)
/* send the io_error flag */
if (protocol_version < 30)
/* send the io_error flag */
if (protocol_version < 30)
}
if (!inc_recurse && f >= 0)
}
if (!inc_recurse && f >= 0)
- recv_uid_list(f, flist);
+ recv_id_list(f, flist);
clean_flist(flist, relative_paths);
clean_flist(flist, relative_paths);
for (i = 0; i < flist->count; i++) {
file = flist->sorted[i];
if ((am_root || am_sender) && preserve_uid) {
for (i = 0; i < flist->count; i++) {
file = flist->sorted[i];
if ((am_root || am_sender) && preserve_uid) {
- snprintf(uidbuf, sizeof uidbuf, " uid=%ld",
- (long)F_UID(file));
+ snprintf(uidbuf, sizeof uidbuf, " uid=%u",
+ F_OWNER(file));
- if (preserve_gid && F_GID(file) != GID_NONE) {
- snprintf(gidbuf, sizeof gidbuf, " gid=%ld",
- (long)F_GID(file));
+ if (preserve_gid) {
+ static char parens[] = "(\0)\0\0\0";
+ char *pp = parens + (file->flags & FLAG_SKIP_GROUP ? 0 : 3);
+ snprintf(gidbuf, sizeof gidbuf, " gid=%s%u%s",
+ pp, F_GROUP(file), pp + 2);
} else
*gidbuf = '\0';
if (!am_sender)
} else
*gidbuf = '\0';
if (!am_sender)