From a60e2dca6b475e41882d9070c90079dfedf6b5bc Mon Sep 17 00:00:00 2001 From: "J.W. Schultz" Date: Sat, 3 Jan 2004 13:17:32 +0000 Subject: [PATCH] Create GID_NONE for use gid test readability. --- generator.c | 6 +++--- rsync.c | 2 +- rsync.h | 2 ++ uidlist.c | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/generator.c b/generator.c index d03ba2bc..ba889703 100644 --- a/generator.c +++ b/generator.c @@ -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; } diff --git a/rsync.c b/rsync.c index ad9293c4..9bd7e421 100644 --- a/rsync.c +++ b/rsync.c @@ -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, diff --git a/rsync.h b/rsync.h index cf018bba..9e3eba17 100644 --- a/rsync.h +++ b/rsync.h @@ -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; diff --git a/uidlist.c b/uidlist.c index 02d551d0..5027e78f 100644 --- a/uidlist.c +++ b/uidlist.c @@ -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); } } -- 2.34.1