#include "rsync.h"
#ifdef HAVE_GETGROUPS
-# if !defined(GETGROUPS_T)
+# ifndef GETGROUPS_T
# define GETGROUPS_T gid_t
# endif
#endif
static int map_uid(int id, char *name)
{
uid_t uid;
- if (uid != 0 && name_to_uid(name, &uid))
+ if (id != 0 && name_to_uid(name, &uid))
return uid;
return id;
}
static int map_gid(int id, char *name)
{
gid_t gid;
- if (gid != 0 && name_to_gid(name, &gid))
+ if (id != 0 && name_to_gid(name, &gid))
return gid;
return id;
}
int id2 = name ? map_uid(id, name) : id;
struct idlist *node;
- node = add_to_list(&uidlist, id, name, map_uid(id, name));
+ node = add_to_list(&uidlist, id, name, id2);
if (verbose > 3) {
rprintf(FINFO, "uid %d(%s) maps to %d\n",
}
}
-
if (preserve_gid && !numeric_ids) {
/* read the gid list */
while ((id = read_int(f)) != 0) {
}
}
- /* now convert the uid/gid of all files in the list to the mapped
- * uid/gid */
+ /* Now convert all the uids/gids from sender values to our values. */
if (am_root && preserve_uid && !numeric_ids) {
for (i = 0; i < flist->count; i++)
flist->files[i]->uid = match_uid(flist->files[i]->uid);