public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Jesse Hathaway <jesse@mbuki-mvuki.org>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	 libc-alpha@sourceware.org
Subject: Re: [PATCH] getlogin_r: return early when linux sentinel value is set
Date: Tue, 20 Mar 2018 18:30:00 -0000	[thread overview]
Message-ID: <877eq6ppkw.fsf@linux-m68k.org> (raw)
In-Reply-To: <CANSNSoVxHOAM9XZx5ghighXLmXQzSvBfy4xp_FU8=_+U2ZXk8Q@mail.gmail.com> (Jesse Hathaway's message of "Tue, 20 Mar 2018 12:52:15 -0500")

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."

  reply	other threads:[~2018-03-20 18:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16 16:18 Jesse Hathaway
2018-03-19 15:03 ` Jesse Hathaway
2018-03-20  8:00 ` Adhemerval Zanella
2018-03-20  9:05   ` Andreas Schwab
2018-03-20 17:52   ` Jesse Hathaway
2018-03-20 18:30     ` Andreas Schwab [this message]
2018-03-21 21:28       ` Jesse Hathaway
2018-03-22  6:14         ` Adhemerval Zanella
2018-03-22 13:49           ` Jesse Hathaway
2018-03-22 17:35         ` Andreas Schwab
2018-03-22 19:30           ` Jesse Hathaway
2018-03-26 14:22             ` Jesse Hathaway
2018-03-26 16:30               ` Adhemerval Zanella
2018-03-28  0:37                 ` Adhemerval Zanella
2018-04-03 10:46                   ` Florian Weimer
2018-04-03 11:41                     ` Adhemerval Zanella
2018-04-03 11:45                       ` Florian Weimer
2018-04-03 11:53                         ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877eq6ppkw.fsf@linux-m68k.org \
    --to=schwab@linux-m68k.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=jesse@mbuki-mvuki.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).