Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Oct 2000 16:16:52 +0200 (CEST)
From:      Cyrille Lefevre <clefevre@citeweb.net>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/22210: typeof(passwd->pw_gid) != typeof(group->gr_gid)
Message-ID:  <200010221416.e9MEGq816551@gits.dyndns.org>

next in thread | raw e-mail | index | archive | help

>Number:         22210
>Category:       bin
>Synopsis:       typeof(passwd->pw_gid) != typeof(group->gr_gid)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 22 07:20:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Cyrille Lefevre
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
ACME
>Environment:

FreeBSD gits 4.1-STABLE FreeBSD 4.1-STABLE #3: Sat Sep 23 10:20:30 CEST 2000     root@gits:/disk2/4.0-stable/src/sys/compile/CUSTOM  i386

>Description:

	the type of the gr_gid member of struct group doesn't match
	the type of the pw_gid member of struct passwd which prevent
	a simple comparison such as passwd->pw_gid == group->gr_gid
	w/o a compiler warning.

>How-To-Repeat:

	cat << EOF > /tmp/c.c
	#include <grp.h>
	#include <pwd.h>
	#include <stdio.h>
	int main ()
	{
		struct passwd *passwd;
		struct group *group;

		passwd = getpwnam("root");
		group = getgrnam("wheel");
		printf ("%d\n", passwd->pw_gid == group->gr_gid);
		return (0);
	}
	EOF
	cc -W -Wall  /tmp/c.c  -o /tmp/c
	/tmp/c.c: In function `main':
	/tmp/c.c:11: warning: comparison between signed and unsigned

>Fix:


Index: grp.h
===================================================================
RCS file: /home/ncvs/src/include/grp.h,v
retrieving revision 1.3
diff -u -r1.3 grp.h
--- grp.h	1997/05/07 19:59:59	1.3
+++ grp.h	2000/10/22 14:09:14
@@ -41,6 +41,8 @@
 #ifndef _GRP_H_
 #define	_GRP_H_
 
+#include <sys/types.h>
+
 #ifndef _POSIX_SOURCE
 #define	_PATH_GROUP		"/etc/group"
 #endif
@@ -48,7 +50,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 */
 };
 

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010221416.e9MEGq816551>