Date: Fri, 11 Aug 1995 16:48:33 +0000 () From: Jeff Evans <evans@fubar.cl.msu.edu> To: freebsd-hackers@freebsd.org Cc: evans@fubar.cl.msu.edu (Jeff Evans) Subject: why are pw_uid and pw_gid defined as int's in pwd.h/grp.h? Message-ID: <199508111648.QAA00972@fubar.cl.msu.edu>
next in thread | raw e-mail | index | archive | help
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 { <hack> int gr_gid; /* group id */ <hack> }; from pwd.h: struct passwd { <hack> int pw_uid; /* user uid */ int pw_gid; /* user gid */ <hack> }; 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; <hack> (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 --------------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508111648.QAA00972>