several more bugs found by coreutils

Corinna Vinschen
Wed Feb 2 14:20:00 GMT 2005

On Feb  2 07:05, Eric Blake wrote:
> > On Feb  1 20:58, Erik Blake wrote:
> Eric, not Erik.

Hups.  I'm wondering how that could happen.  I didn't change the
address manually.  Weird.  Sorry 'bout that, anyway.

> > include/pwd.h is a newlib file.  However, I was pretty happy that pw_uid
> > and pw_gid were defined as int, when we changed uids and gids from 16 to
> > 32 bits.  It was the one file which wasn't necessary to change.
> Is it worth introducing two definitions in cygwin, guarded by
> __CYGWIN_USE_BIG_TYPES__, as is done elsewhere (for example sys/dirent.h)?
>  Or how about something like the following to ensure that pw_comment
> remains at the same offset regardless of whether sizeof(uid_t) == sizeof(int):
> struct passwd {
>   char *pw_name;
>   char *pw_passwd;
>   union {
>     int __filler;
>     uid_t upw_uid;
>   } u;
> /* etc. */
> };
> #define pw_uid u.upw_uid;

Urgh.  That's ugly, IMHO.  Basically, uid_t should be used always.
For the sake of a questionable backward compatibility, it might be
worth to do something like this:

  #if defined (__CYGWIN__) && !defined (__CYGWIN_USE_BIG_TYPES__)
  #define __pw_uid_t int
  #ifndef __pw_uid_t
  #define __pw_uid_t uid_t;

  struct passwd {
    char *pw_name;
    char *pw_passwd;
    __pw_uid_t pw_uid;
    __pw_gid_t pw_gid;

Would that be ok, Jeff?


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader
Red Hat, Inc.

More information about the Newlib mailing list