Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Aug 1995 15:32:42 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        evans@fubar.cl.msu.edu, freebsd-hackers@FreeBSD.org
Subject:   Re: why are pw_uid and pw_gid defined as int's in pwd.h/grp.h?
Message-ID:  <199508120532.PAA01476@godzilla.zeta.org.au>

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.

<pwd.h> and <grp.h> are broken, perhaps for compatibility with broken
applications.

>  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);

This is a good example of application broken-ness.

Bruce



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