[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: who(1) exit status
From: |
Bo Borgerson |
Subject: |
Re: who(1) exit status |
Date: |
Mon, 23 Jun 2008 08:59:44 -0400 |
User-agent: |
Thunderbird 2.0.0.14 (X11/20080505) |
Andreas Schwab wrote:
> Eric Blake <address@hidden> writes:
>
>> According to Shal-Linux-Ind on 6/23/2008 4:05 AM:
>> | Hi,
>> |
>> | who(1) exit status is always 0.
>> |
>> | $ who --v
>> | who (coreutils) 5.2.1
>>
>> Thanks for the report. Consider upgrading - that is several years old,
>> and the latest stable version is 6.12. But I have confirmed that the
>> issue still exists in git beyond 6.12:
>>
>> $ who /nosuch/file; echo $?
>> 0
>
> See the comment in read_utmp:
>
> /* Ignore the return value for now.
> Solaris' utmpname returns 1 upon success -- which is contrary
> to what the GNU libc version does. In addition, older GNU libc
> versions are actually void. */
> UTMP_NAME_FUNCTION (file);
>
> When using the utmpname/setutent/getutmp family of functions there
> really is no way to check for errors reading the file, since utmpname
> does not actually try to open it, and setutent has no return value.
Hi,
So it sounds like there's no portable way to distinguish between:
1. an error trying to look up information
2. no information to be found
Would it make sense, though, to return a nonzero exit code when output
is empty in either case?
Thanks,
Bo