From 5567b258ebfb1a00cb9d07371894eae183e09a25 Mon Sep 17 00:00:00 2001
From: Mark Murray <markm@FreeBSD.org>
Date: Tue, 22 Jan 2002 17:32:53 +0000
Subject: [PATCH] Use the proper type (gid_t) for (group)->gr_gid to be
 orthogonal with uid_t usage and (user)->pw_uid.

PR:		3242
---
 include/grp.h               |  3 ++-
 include/unistd.h            |  4 ++--
 lib/libc/gen/getgrent.3     |  2 +-
 lib/libc/gen/getgrouplist.3 |  4 ++--
 lib/libc/gen/getgrouplist.c | 13 ++++++++-----
 lib/libc/gen/initgroups.3   |  2 +-
 lib/libc/gen/initgroups.c   | 10 ++++------
 7 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/include/grp.h b/include/grp.h
index 9e5654a958d3..2e245d5afc04 100644
--- a/include/grp.h
+++ b/include/grp.h
@@ -36,6 +36,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)grp.h	8.2 (Berkeley) 1/21/94
+ * $FreeBSD$
  */
 
 #ifndef _GRP_H_
@@ -48,7 +49,7 @@
 struct group {
 	char	*gr_name;		/* group name */
 	char	*gr_passwd;		/* group password */
-	int	gr_gid;			/* group id */
+	gid_t	gr_gid;			/* group id */
 	char	**gr_mem;		/* group members */
 };
 
diff --git a/include/unistd.h b/include/unistd.h
index bfad0f295a0c..37dab6712019 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -140,7 +140,7 @@ int	 ftruncate __P((int, off_t));
 #endif
 int	 getdomainname __P((char *, int));
 int	 getdtablesize __P((void));
-int	 getgrouplist __P((const char *, int, int *, int *));
+int	 getgrouplist __P((const char *, gid_t, gid_t *, int *));
 long	 gethostid __P((void));
 int	 gethostname __P((char *, int));
 int	 getlogin_r __P((char *, int));
@@ -154,7 +154,7 @@ int	 getresuid __P((uid_t *, uid_t *, uid_t *));
 int	 getsid __P((pid_t _pid));
 char	*getusershell __P((void));
 char	*getwd __P((char *));			/* obsoleted by getcwd() */
-int	 initgroups __P((const char *, int));
+int	 initgroups __P((const char *, gid_t));
 int	 iruserok __P((unsigned long, int, const char *, const char *));
 int	 iruserok_sa __P((const void *, int, int, const char *, const char *));
 int	 issetugid __P((void));
diff --git a/lib/libc/gen/getgrent.3 b/lib/libc/gen/getgrent.3
index bdfe039af2e2..f32a901556f0 100644
--- a/lib/libc/gen/getgrent.3
+++ b/lib/libc/gen/getgrent.3
@@ -78,7 +78,7 @@ file
 struct group {
 	char	*gr_name;	/* group name */
 	char	*gr_passwd;	/* group password */
-	int	gr_gid;		/* group id */
+	gid_t	gr_gid;		/* group id */
 	char	**gr_mem;	/* group members */
 };
 .Ed
diff --git a/lib/libc/gen/getgrouplist.3 b/lib/libc/gen/getgrouplist.3
index ecf53f2f9543..da949c7ebb2f 100644
--- a/lib/libc/gen/getgrouplist.3
+++ b/lib/libc/gen/getgrouplist.3
@@ -43,7 +43,7 @@
 .Sh SYNOPSIS
 .In unistd.h
 .Ft int
-.Fn getgrouplist "const char *name" "int basegid" "int *groups" "int *ngroups"
+.Fn getgrouplist "const char *name" "gid_t basegid" "gid_t *groups" "int *ngroups"
 .Sh DESCRIPTION
 The
 .Fn getgrouplist
@@ -56,7 +56,7 @@ is automatically included in the groups list.
 Typically this value is given as
 the group number from the password file.
 .Pp
-The resulting group list is returned in the integer array pointed to by
+The resulting group list is returned in the array pointed to by
 .Fa groups .
 The caller specifies the size of the
 .Fa groups
diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c
index 31f90b4490e2..0de6c55757de 100644
--- a/lib/libc/gen/getgrouplist.c
+++ b/lib/libc/gen/getgrouplist.c
@@ -31,9 +31,12 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)getgrouplist.c	8.2 (Berkeley) 12/8/94";
-#endif /* LIBC_SCCS and not lint */
+#endif
 
 /*
  * get credential
@@ -45,12 +48,12 @@ static char sccsid[] = "@(#)getgrouplist.c	8.2 (Berkeley) 12/8/94";
 int
 getgrouplist(uname, agroup, groups, grpcnt)
 	const char *uname;
-	int agroup;
-	register int *groups;
+	gid_t agroup;
+	gid_t *groups;
 	int *grpcnt;
 {
-	register struct group *grp;
-	register int i, ngroups;
+	struct group *grp;
+	int i, ngroups;
 	int ret, maxgroups;
 
 	ret = 0;
diff --git a/lib/libc/gen/initgroups.3 b/lib/libc/gen/initgroups.3
index 115ab0c34305..3df1ffd49e93 100644
--- a/lib/libc/gen/initgroups.3
+++ b/lib/libc/gen/initgroups.3
@@ -43,7 +43,7 @@
 .Sh SYNOPSIS
 .In unistd.h
 .Ft int
-.Fn initgroups "const char *name" "int basegid"
+.Fn initgroups "const char *name" "gid_t basegid"
 .Sh DESCRIPTION
 The
 .Fn initgroups
diff --git a/lib/libc/gen/initgroups.c b/lib/libc/gen/initgroups.c
index 3fc9bb2f4042..16ffb49e011c 100644
--- a/lib/libc/gen/initgroups.c
+++ b/lib/libc/gen/initgroups.c
@@ -31,14 +31,12 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
 #if defined(LIBC_SCCS) && !defined(lint)
-#if 0
 static char sccsid[] = "@(#)initgroups.c	8.1 (Berkeley) 6/4/93";
-#else
-static const char rcsid[] =
-  "$FreeBSD$";
 #endif
-#endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 
@@ -51,7 +49,7 @@ static const char rcsid[] =
 int
 initgroups(uname, agroup)
 	const char *uname;
-	int agroup;
+	gid_t agroup;
 {
 	int groups[NGROUPS], ngroups;