This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: several more bugs found by coreutils
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com, newlib at sources dot redhat dot com
- Date: Wed, 2 Feb 2005 15:20:01 +0100
- Subject: Re: several more bugs found by coreutils
- References: <020120052058.2301.41FFED5A000D5EEC000008FD22007614380A050E040D0C079D0A@comcast.net> <20050202100718.GA7767@cygbert.vinschen.de> <4200DE19.70504@byu.net>
- Reply-to: cygwin at cygwin dot com, newlib at sources dot redhat dot com
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
#endif
#ifndef __pw_uid_t
#define __pw_uid_t uid_t;
#endif
struct passwd {
char *pw_name;
char *pw_passwd;
__pw_uid_t pw_uid;
__pw_gid_t pw_gid;
[etc].
Would that be ok, Jeff?
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader mailto:cygwin@cygwin.com
Red Hat, Inc.