mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-20 12:54:15 -04:00
Create GID_NONE for use gid test readability.
This commit is contained in:
1 parent
86c4601e12
commit
a60e2dca6b
4 files changed
+8
-6
No files matched your search
+3
-3
@@ -54,14 +54,14 @@ static int skip_file(char *fname,
|
||||
}
|
||||
if (link_dest) {
|
||||
if (preserve_perms
|
||||
&& (st->st_mode & ~_S_IFMT) != (file->mode & ~_S_IFMT))
|
||||
&& (st->st_mode & ~_S_IFMT) != (file->mode & ~_S_IFMT))
|
||||
return 0;
|
||||
|
||||
if (am_root && preserve_uid && st->st_uid != file->uid)
|
||||
return 0;
|
||||
|
||||
if (preserve_gid && file->gid != (gid_t)-1
|
||||
&& st->st_gid != file->gid)
|
||||
if (preserve_gid && file->gid != GID_NONE
|
||||
&& st->st_gid != file->gid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
|
||||
}
|
||||
|
||||
change_uid = am_root && preserve_uid && st->st_uid != file->uid;
|
||||
change_gid = preserve_gid && file->gid != (gid_t)-1
|
||||
change_gid = preserve_gid && file->gid != GID_NONE
|
||||
&& st->st_gid != file->gid;
|
||||
if (change_uid || change_gid) {
|
||||
if (do_lchown(fname,
|
||||
|
||||
@@ -362,6 +362,8 @@ enum logcode {FNONE=0, FERROR=1, FINFO=2, FLOG=3 };
|
||||
#define IN_LOOPBACKNET 127
|
||||
#endif
|
||||
|
||||
#define GID_NONE (gid_t) -1
|
||||
|
||||
struct file_struct {
|
||||
unsigned flags;
|
||||
time_t modtime;
|
||||
|
||||
@@ -160,7 +160,7 @@ static gid_t match_gid(gid_t gid)
|
||||
if (am_root)
|
||||
last_out = gid;
|
||||
else
|
||||
last_out = (gid_t)-1;
|
||||
last_out = GID_NONE;
|
||||
return last_out;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ void recv_uid_list(int f, struct file_list *flist)
|
||||
}
|
||||
list->id2 = map_gid(id, name);
|
||||
if (!am_root && !is_in_group(list->id2))
|
||||
list->id2 = (gid_t)-1;
|
||||
list->id2 = GID_NONE;
|
||||
free(name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user