[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: Re: error.c: "Unknown system error" should report errno value
From: |
Jim Meyering |
Subject: |
Re: Fwd: Re: error.c: "Unknown system error" should report errno value |
Date: |
Wed, 03 Oct 2007 19:17:52 +0200 |
Martin Koeppe <address@hidden> wrote:
> On Wed, 3 Oct 2007, Jim Meyering wrote:
>> Martin Koeppe <address@hidden> wrote:
>>> A question arises: How should one portably test for "root"? Neither
>>> "root" nor uid 0 seem to be a POSIX requirement. I found one solution
>>> so far, but I'm not sure how good it really is:
>>>
>>> For shell scripts run:
>>> $ /usr/sbin/chroot / /bin/true
>>> If successful, you have root rights.
>>
>> I'm leery of this.
>> What if chroot works for non-privileged users on some type of system?
>>
>> Since Interix is the problem here, how about adding
>> a test that'd be run solely on that system?
>
> Yes, no problem with that. I only thought there might be a
> possibility to check the root-ness without an explicit comparison of
> uid or username. This need not necessarily be the chroot() function.
> But I don't know the POSIX standard in that detail.
>
> If you want an explicit check, then for Interix 3 different users/uids
> must be checked: System (uid ???), Domain Administrator (uid 1049076)
> and local Administrator (uid 197108). All of these have "root" rights.
> See: http://www.interopcommunity.com/faqs.aspx#307
But those are all legitimate, non-root IDs on other systems,
so a test based solely on that would risk false positives.
There has to be something else (interix-specific) that will
ensure that part of the test is run only on Interix.
- Re: gettext clobbers errno (was: Re: Fwd: Re: error.c: "Unknown system error" should report errno value), (continued)
- Re: gettext clobbers errno (was: Re: Fwd: Re: error.c: "Unknown system error" should report errno value), Bruno Haible, 2007/10/14
- Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Bruno Haible, 2007/10/06
- Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Jim Meyering, 2007/10/06
- Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Bruno Haible, 2007/10/06
- Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Martin Koeppe, 2007/10/08
- Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Bruno Haible, 2007/10/08
- Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Martin Koeppe, 2007/10/08
- Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Bruno Haible, 2007/10/08
Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Jim Meyering, 2007/10/03
Re: Fwd: Re: error.c: "Unknown system error" should report errno value, John Cowan, 2007/10/03
Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Jim Meyering, 2007/10/03
Re: Fwd: Re: error.c: "Unknown system error" should report errno value, Eric Blake, 2007/10/03