bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#10021: [PATCH id] Add error-checking on GNU


From: Ludovic Courtès
Subject: Re: bug#10021: [PATCH id] Add error-checking on GNU
Date: Sun, 13 Nov 2011 23:02:19 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux)

Hi Paul,

Paul Eggert <address@hidden> skribis:

> On 11/12/11 13:48, Ludovic Courtès wrote:
>> +#ifdef __GNU__
>> +      if (euid == -1 && !use_real
>> +          && !just_group && !just_group_list && !just_context)
>> +        error (EXIT_FAILURE, errno, _("cannot get effective UID"));
>> +#endif
>
> I suggest removing the "#ifdef __GNU__" here and in its other
> three uses in the patch, as functions like as geteuid() can fail on
> a few non-GNU systems too.  See:
>
> http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fapis%2Fgeteuid.htm
>
> For this particular application (the 'id' program) I doubt whether
> it's worth our time to configure this stuff at compile-time,
> and that it's fine to do a run-time check on all platforms.

OTOH, on POSIX-conforming systems (which includes GNU/Linux, so it may
be the majority of systems in use), -1 may well be a valid UID/GID.

That’s why I was conservative and decided to ifdef that.  This ifdef
also served as a documentation that this is a GNU extension to POSIX.

Perhaps it’d be safer to keep an ifdef and list all the OSes known to
have this behavior?

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]