This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [PATCH] getlogin_r: return early when linux sentinel value is set


On Mär 20 2018, Jesse Hathaway <jesse@mbuki-mvuki.org> wrote:

>> Also,
>> __getlogin_r_loginuid should set errno itself as for ERANGE instead
>> of just return its value (errno won't be set in this case and I think
>> it got it wrong for ENOMEM in this case).
>
> Would you be so kind as to explain this a little more to someone with
> very little C experience. I returned the errno value because the
> comment on the function indicates that is what the caller expects:
>
> /* Try to determine login name from /proc/self/loginuid and return 0
>    if successful.  If /proc/self/loginuid cannot be read return -1.
>    Otherwise return the error number.  */
>
> and getlogin when it calls __getlogin_r_loginuid, only checks the
> return value, and not the errno value

Depends on whether you want the linux __getlogin_r to fall back to the
generic __getlogin_r.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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