This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: several more bugs found by coreutils


On Wed, Feb 02, 2005 at 03:20:01PM +0100, Corinna Vinschen wrote:
>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?

Why not just make __pw_uid_t a typedef?

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]