From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id A07103858402 for ; Fri, 12 Nov 2021 15:44:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A07103858402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nefkom.net Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4HrNFD4JP7z1qwyM; Fri, 12 Nov 2021 16:44:48 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4HrNFD3t0vz1qqkC; Fri, 12 Nov 2021 16:44:48 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id BLsZRU3zFl-6; Fri, 12 Nov 2021 16:44:47 +0100 (CET) X-Auth-Info: Jyz5RvcyKqTQr9h2SV1gKcXY+tQWo0crDshQl2b7qXW7HaDbemT7g5aHjG7yXm6g Received: from igel.home (ppp-46-244-178-12.dynamic.mnet-online.de [46.244.178.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 12 Nov 2021 16:44:47 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 371452C3951; Fri, 12 Nov 2021 16:44:47 +0100 (CET) From: Andreas Schwab To: Adhemerval Zanella via Libc-alpha Cc: Adhemerval Zanella , leonardo.macchia@gmail.com Subject: Re: [PATCH v2 3/3] inet: Return EAI_MEMORY when nrl_domainname() fails to allocate memory References: <20211112142114.239913-1-adhemerval.zanella@linaro.org> <20211112142114.239913-4-adhemerval.zanella@linaro.org> X-Yow: I have accepted Provolone into my life! Date: Fri, 12 Nov 2021 16:44:47 +0100 In-Reply-To: <20211112142114.239913-4-adhemerval.zanella@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Fri, 12 Nov 2021 11:21:14 -0300") Message-ID: <87ee7ltm34.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2021 15:44:51 -0000 On Nov 12 2021, Adhemerval Zanella via Libc-alpha wrote: > diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c > index 2d2397e7dc..2bec3263fc 100644 > --- a/inet/getnameinfo.c > +++ b/inet/getnameinfo.c > @@ -83,7 +83,7 @@ libc_freeres_ptr (static char *domain); > now ignored. */ > #define DEPRECATED_NI_IDN 192 > > -static void > +static bool > nrl_domainname_core (struct scratch_buffer *tmpbuf) > { > char *c; > @@ -97,7 +97,7 @@ nrl_domainname_core (struct scratch_buffer *tmpbuf) > if (herror == NETDB_INTERNAL && errno == ERANGE) > { > if (!scratch_buffer_grow (tmpbuf)) > - return; > + return false; > } > else > break; > @@ -111,10 +111,13 @@ nrl_domainname_core (struct scratch_buffer *tmpbuf) > now to get more information. */ > while (__gethostname (tmpbuf->data, tmpbuf->length)) > if (!scratch_buffer_grow (tmpbuf)) > - return; > + return false; > > if ((c = strchr (tmpbuf->data, '.')) != NULL) > - domain = __strdup (++c); > + { > + domain = __strdup (++c); > + return domain != NULL; > + } > else You can remove `else' here and save a level of indentation. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."