From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15825 invoked by alias); 20 Mar 2018 18:30:33 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 9668 invoked by uid 89); 20 Mar 2018 18:30:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mail-out.m-online.net X-Auth-Info: +9MTq653t3w8tP1p/vnFQMSbeuQoAI/3LeGCrPJf9ExhoguIsnKthAGU2jRtL+Qv From: Andreas Schwab To: Jesse Hathaway Cc: Adhemerval Zanella , libc-alpha@sourceware.org Subject: Re: [PATCH] getlogin_r: return early when linux sentinel value is set References: <73b04097-ef36-b597-4f7c-2e73c6eb9fa3@linaro.org> X-Yow: O.K.! Speak with a PHILADELPHIA ACCENT!! Send out for CHINESE FOOD!! Hop a JET! Date: Tue, 20 Mar 2018 18:30:00 -0000 In-Reply-To: (Jesse Hathaway's message of "Tue, 20 Mar 2018 12:52:15 -0500") Message-ID: <877eq6ppkw.fsf@linux-m68k.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-03/txt/msg00491.txt.bz2 On Mär 20 2018, Jesse Hathaway 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."