From owner-freebsd-hackers Fri Aug 11 13:48:13 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id NAA09565 for hackers-outgoing; Fri, 11 Aug 1995 13:48:13 -0700 Received: from fubar.cl.msu.edu (fubar.cl.msu.edu [35.8.1.18]) by freefall.FreeBSD.org (8.6.11/8.6.6) with ESMTP id NAA09536 for ; Fri, 11 Aug 1995 13:47:58 -0700 Received: (from evans@localhost) by fubar.cl.msu.edu (8.6.11/8.6.9) id QAA00972; Fri, 11 Aug 1995 16:48:33 GMT From: Jeff Evans Message-Id: <199508111648.QAA00972@fubar.cl.msu.edu> Subject: why are pw_uid and pw_gid defined as int's in pwd.h/grp.h? To: freebsd-hackers@freebsd.org Date: Fri, 11 Aug 1995 16:48:33 +0000 () Cc: evans@fubar.cl.msu.edu (Jeff Evans) X-Mailer: ELM [version 2.4 PL24] Content-Type: text Content-Length: 1545 Sender: hackers-owner@freebsd.org Precedence: bulk Does anyone know why in pwd.h inside the password struct both pw_uid and pw_gid items are defined as int's? Shouldn't they be uid_t and gid_t? Also on a similar note in the grp.h file inside the definition of struct group, item gr_gid is defined as an int and not gid_t. from grp.h: struct group { int gr_gid; /* group id */ }; from pwd.h: struct passwd { int pw_uid; /* user uid */ int pw_gid; /* user gid */ }; from sys/types.h: typedef unsigned long gid_t; /* group id */ typedef unsigned long uid_t; /* user id */ I realize that INT_MAX = 2,147,483,647(from machine/limits.h) which is only half of ULONG_MAX. Even so, shouldn't pwd.h and grp.h be changed? My main concern is that I am writing library functions that add/delete users and groups and need to be able to print them out correctly. Currently chpass(and the other password utils) print it out like this: from src/usr.bin/chpass/pw_copy.c: struct passwd *pw; (void)fprintf(to, "%s:%s:%d:%d:%s:%ld:%ld:%s:%s:%s\n", pw->pw_name, pw->pw_passwd, pw->pw_uid, pw->pw_gid, pw->pw_class, pw->pw_change, pw->pw_expire, pw->pw_gecos, pw->pw_dir, pw->pw_shell); Jeff Evans -------------------------------------------------------------------------- Jeff Evans - evans@fubar.cl.msu.edu --------------------------------------------------------------------------