If RESTRICT_* environments aren't set, don't try to enable group -1. HEAD
authorTimo Sirainen <tss@iki.fi>
Sun, 06 Jan 2008 00:19:10 +0200
branchHEAD
changeset 7112bffc8788eb94
parent 7111 3b61ff127127
child 7113 d5dd0841b2db
If RESTRICT_* environments aren't set, don't try to enable group -1.
src/lib/restrict-access.c
     1.1 --- a/src/lib/restrict-access.c	Sat Jan 05 02:29:24 2008 +0200
     1.2 +++ b/src/lib/restrict-access.c	Sun Jan 06 00:19:10 2008 +0200
     1.3 @@ -112,10 +112,14 @@
     1.4  			return;
     1.5  		}
     1.6  	} else {
     1.7 +		if (egid == (gid_t)-1 && *tmp == NULL) {
     1.8 +			/* nothing to do */
     1.9 +			return;
    1.10 +		}
    1.11  		/* Some OSes don't like an empty groups list,
    1.12  		   so use the effective GID as the only one. */
    1.13  		gid_list = t_new(gid_t, 2);
    1.14 -		gid_list[0] = egid;
    1.15 +		gid_list[0] = egid != (gid_t)-1 ? egid : getegid();
    1.16  		gid_count = 1;
    1.17  	}
    1.18