diff options
| author | Alfred Perlstein <alfred@FreeBSD.org> | 2000-08-23 23:36:32 +0000 |
|---|---|---|
| committer | Alfred Perlstein <alfred@FreeBSD.org> | 2000-08-23 23:36:32 +0000 |
| commit | 00e64813a27363418fa269fe9498a2d57bfa7d91 (patch) | |
| tree | 3c3e43a7eee457fca66cd306d307c985ad15593d /usr.sbin/lpr | |
| parent | 03f808c55a5e7c1a745def1ec91e8540723f3c90 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/lpr')
| -rw-r--r-- | usr.sbin/lpr/lpc/lpc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/lpr/lpc/lpc.c b/usr.sbin/lpr/lpc/lpc.c index 5bfa85920f5a..866b8aca21dd 100644 --- a/usr.sbin/lpr/lpc/lpc.c +++ b/usr.sbin/lpr/lpc/lpc.c @@ -334,6 +334,7 @@ ingroup(grname) char *grname; { static struct group *gptr=NULL; + static int ngroups = 0; static gid_t groups[NGROUPS]; register gid_t gid; register int i; @@ -343,11 +344,12 @@ ingroup(grname) warnx("warning: unknown group '%s'", grname); return(0); } - if (getgroups(NGROUPS, groups) < 0) + ngroups = getgroups(NGROUPS, groups); + if (ngroups < 0) err(1, "getgroups"); } gid = gptr->gr_gid; - for (i = 0; i < NGROUPS; i++) + for (i = 0; i < ngroups; i++) if (gid == groups[i]) return(1); return(0); |
