Change getgroups to use GETGROUPS_T as the type of the group array returned,
[rsync/rsync.git] / rsync.c
diff --git a/rsync.c b/rsync.c
index 178dc52..02dd837 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -115,10 +115,10 @@ int delete_file(char *fname)
 
 static int is_in_group(gid_t gid)
 {
-#ifdef HAVE_GETGROUPS
+#ifdef GETGROUPS_T
        static gid_t last_in = (gid_t) -2, last_out;
        static int ngroups = -2;
-       static gid_t *gidset;
+       static GETGROUPS_T *gidset;
        int n;
 
        if (gid == last_in)
@@ -127,7 +127,7 @@ static int is_in_group(gid_t gid)
                /* treat failure (-1) as if not member of any group */
                ngroups = getgroups(0, 0);
                if (ngroups > 0) {
-                       gidset = (gid_t *) malloc(ngroups * sizeof(gid_t));
+                       gidset = (GETGROUPS_T *) malloc(ngroups * sizeof(GETGROUPS_T));
                        ngroups = getgroups(ngroups, gidset);
                }
        }
@@ -202,7 +202,7 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
 #ifdef HAVE_CHMOD
        if (preserve_perms && !S_ISLNK(st->st_mode) &&
            (st->st_mode != file->mode || 
-            (updated && (file->mode & ~ACCESSPERMS)))) {
+            (updated && (file->mode & ~INITPERMMASK)))) {
                updated = 1;
                if (do_chmod(fname,file->mode) != 0) {
                        rprintf(FERROR,"failed to set permissions on %s : %s\n",
@@ -260,7 +260,7 @@ void finish_transfer(char *fname, char *fnametmp, struct file_struct *file)
                if (errno == EXDEV) {
                        /* rename failed on cross-filesystem link.  
                           Copy the file instead. */
-                       if (copy_file(fnametmp,fname, file->mode & ACCESSPERMS)) {
+                       if (copy_file(fnametmp,fname, file->mode & INITPERMMASK)) {
                                rprintf(FERROR,"copy %s -> %s : %s\n",
                                        fnametmp,fname,strerror(errno));
                        } else {