extern int preserve_uid;
extern int preserve_gid;
extern int numeric_ids;
+extern int am_root;
struct idlist {
struct idlist *next;
list = list->next;
}
- last_out = gid;
+ if (am_root)
+ last_out = gid;
+ else
+ last_out = (gid_t) -1;
return last_out;
}
}
}
- if (!uidlist && !gidlist) return;
+ if (!(am_root && preserve_uid) && !preserve_gid) return;
/* now convert the uid/gid of all files in the list to the mapped
uid/gid */
for (i=0;i<flist->count;i++) {
- if (preserve_uid && flist->files[i]->uid != 0) {
+ if (am_root && preserve_uid && flist->files[i]->uid != 0) {
flist->files[i]->uid = match_uid(flist->files[i]->uid);
}
if (preserve_gid && flist->files[i]->gid != 0) {