This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: RFC and patch: pw_comment
- To: Werner Almesberger <almesber at lrc dot epfl dot ch>
- Subject: Re: RFC and patch: pw_comment
- From: "J. Johnston" <jjohnstn at cygnus dot com>
- Date: Tue, 29 Aug 2000 14:11:06 -0400
- CC: newlib at sources dot redhat dot com
- Organization: Red Hat Inc.
- References: <200008230750.JAA19737@lrcsun15.epfl.ch>
Werner Almesberger wrote:
>
> There's something puzzling in libc/unix/getpwent.c: it uses a field
> pw_comment which doesn't seem to exist on any Unix I know. Furthermore,
> the sscanf format string lacks one element, so I assume that pw_comment
> was added without ever using or testing the whole thing. (There's no
> ChangeLog or newlib-cvs list entry either.)
>
> I've attached a patch that simply removes the comment field and sets
> pw_comment to an empty string. If there is a good reason to keep the
> comment thing around, all this would have to become conditional instead.
>
> - Werner
>
The file was initially checked in 1992 and was originally written for a SCONIX port.
The engineer who did this is long gone. Looking at some UnixWare machines we have,
the comment field is not there, so I think we will go ahead and remove it.
The patch has been checked in.
-- Jeff Johnston (Red Hat Inc)
> ---------------------------------- ChangeLog ----------------------------------
>
> 2000-08-23 Werner Almesberger <Werner.Almesberger@epfl.ch>
> * libc/unix/getpwent.c (getpwnam, getpwuid, getpwent): removed
> (broken) support for non-existent /etc/passwd field "comment"
>
> ------------------------------------ patch ------------------------------------
>
> --- orig/newlib/libc/unix/getpwent.c Wed Aug 23 09:36:48 2000
> +++ src/newlib/libc/unix/getpwent.c Wed Aug 23 09:36:50 2000
> @@ -12,7 +12,6 @@
>
> static char logname[8];
> static char password[1024];
> -static char comment[1024];
> static char gecos[1024];
> static char dir[1024];
> static char shell[1024];
> @@ -33,11 +32,11 @@
> {
> sscanf (buf, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%s\n",
> logname, password, &pw_passwd.pw_uid,
> - &pw_passwd.pw_gid, comment, gecos,
> + &pw_passwd.pw_gid, gecos,
> dir, shell);
> pw_passwd.pw_name = logname;
> pw_passwd.pw_passwd = password;
> - pw_passwd.pw_comment = comment;
> + pw_passwd.pw_comment = "";
> pw_passwd.pw_gecos = gecos;
> pw_passwd.pw_dir = dir;
> pw_passwd.pw_shell = shell;
> @@ -67,11 +66,11 @@
> {
> sscanf (buf, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%s\n",
> logname, password, &pw_passwd.pw_uid,
> - &pw_passwd.pw_gid, comment, gecos,
> + &pw_passwd.pw_gid, gecos,
> dir, shell);
> pw_passwd.pw_name = logname;
> pw_passwd.pw_passwd = password;
> - pw_passwd.pw_comment = comment;
> + pw_passwd.pw_comment = "";
> pw_passwd.pw_gecos = gecos;
> pw_passwd.pw_dir = dir;
> pw_passwd.pw_shell = shell;
> @@ -99,11 +98,11 @@
>
> sscanf (buf, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%s\n",
> logname, password, &pw_passwd.pw_uid,
> - &pw_passwd.pw_gid, comment, gecos,
> + &pw_passwd.pw_gid, gecos,
> dir, shell);
> pw_passwd.pw_name = logname;
> pw_passwd.pw_passwd = password;
> - pw_passwd.pw_comment = comment;
> + pw_passwd.pw_comment = "";
> pw_passwd.pw_gecos = gecos;
> pw_passwd.pw_dir = dir;
> pw_passwd.pw_shell = shell;
>
> --
> _________________________________________________________________________
> / Werner Almesberger, ICA, EPFL, CH werner.almesberger@ica.epfl.ch /
> /_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/