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

2011-11-15 Thread Paul Eggert
On 11/15/11 09:10, Jim Meyering wrote: > I like that. Thanks! You're welcome; I pushed it. Similar fixes are needed for groups.c, install.c, su.c, test.c, and whoami.c, due to the possibility of getuid etc. failing on GNU/Hurd. I'll add this to my list of things to do, and post a patch here, un

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

2011-11-15 Thread Jim Meyering
Paul Eggert wrote: > On 11/15/11 05:07, Ludovic Courtès wrote: > >> On GNU/Hurd, no error would ever be raised (since uid_t is unsigned), > > Ouch. Thanks, now I understand Roland's suggestion. > How about this patch instead? > > id: handle (uid_t) -1 more portably > * src/id.c (GETID_MAY_FAIL): R

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

2011-11-15 Thread Eric Blake
On 11/15/2011 09:59 AM, Paul Eggert wrote: > On 11/15/11 05:07, Ludovic Courtès wrote: > >> On GNU/Hurd, no error would ever be raised (since uid_t is unsigned), > > Ouch. Thanks, now I understand Roland's suggestion. > How about this patch instead? >else > { > + /* POSIX says get

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

2011-11-15 Thread Paul Eggert
On 11/15/11 05:07, Ludovic Courtès wrote: > On GNU/Hurd, no error would ever be raised (since uid_t is unsigned), Ouch. Thanks, now I understand Roland's suggestion. How about this patch instead? id: handle (uid_t) -1 more portably * src/id.c (GETID_MAY_FAIL): Remove. (main): Check for nonzero

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

2011-11-15 Thread Ludovic Courtès
Hi Paul, Paul Eggert skribis: > - if (GETID_MAY_FAIL && euid == -1 && !use_real > + if (euid < 0 && !use_real >&& !just_group && !just_group_list && !just_context) > error (EXIT_FAILURE, errno, _("cannot get effective UID")); On GNU/Hurd, no error would ever be ra