From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bird.elm.relay.mailchannels.net (bird.elm.relay.mailchannels.net [23.83.212.17]) by sourceware.org (Postfix) with ESMTPS id 490703858D20 for ; Wed, 24 May 2023 22:49:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 490703858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D10F42611B8; Wed, 24 May 2023 22:49:24 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 63F2F2610BA; Wed, 24 May 2023 22:49:24 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1684968564; a=rsa-sha256; cv=none; b=iOHzl9lanP9sqkJQUDMnY207tK0qXnnUxz78XStMhDqqniKK0e1ojbbTl1uhgl/cKHn+U9 h+Duh+jmNJRunyGVQlskNWKSfxj79bXd1zsGqVC04iqlYI7Iwh7cyP1cw1sSdkpD03AZvg 3/zR4CpjxGJ220PsOnZnoxfAj6LYD+pwS3FwQA+1dVJmHv3Ze2j7IB9FO4460XhdcGfezH zROdY/buIAoxpkkqkSon7Dr1wmY2VxSP7DJhfaD/MV9BrUMIhY8TwN73aQaqtH3Cdhf3jn M18nbWQ6pg4GvXKcaSdByIAU8nXALQGO17r+WgSut12+FSw/fVKx3f2FK/gaug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1684968564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/seM2iiFMGd9Fpy/LqLliQr88ampHCe+xDaRzek3MpY=; b=AeWrCjP+5F6eanf5fc+YXHB48RmIhvwDhKEbgfGsyCMZyVwMxANO0hJscXwooRibxmimuM DsbP+r8PD1AwipIZHH+DnSmFq9kg3hN0XWGeIiw55IA+NbSJlJpkXeZJ3dxQuW6xSDM0eB 5ixmjb3WBsNxMcsGEeIxEi5s8KMUmialkHCCNYgnSBl0eZkHRSbC+abn3rcgcr6PRXyTTq aGuR3Wmh/6tb19lyY55MYAp9fMK1HJf5WvJXE8rnApRkzawOGTpXJCAdEqsvo73M8qRBQz ER0ikt22qFltNFAiPEIfD+Q5kfTsYOKeV9jMVRE6q7p0R/lmMckE8T6grTUpJw== ARC-Authentication-Results: i=1; rspamd-5cdf8fd7d9-lpckn; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Chief-Wiry: 3ff472a75bf12f66_1684968564634_2641226006 X-MC-Loop-Signature: 1684968564634:4157236325 X-MC-Ingress-Time: 1684968564633 Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.127.59.19 (trex/6.8.1); Wed, 24 May 2023 22:49:24 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-02-142-113-138-85.dsl.bell.ca [142.113.138.85]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a306.dreamhost.com (Postfix) with ESMTPSA id 4QRRFc0FkDzB5; Wed, 24 May 2023 15:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1684968564; bh=/seM2iiFMGd9Fpy/LqLliQr88ampHCe+xDaRzek3MpY=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=ujIv2vEn1NcUxN+jzg2GLwFB8sfm5q5+TWnMZafkNKmiCn3DhyFp17525NNnPpeCY GZeawGXlxvJ/oTH7wA45r+cFcp1GxuuWYcHikToo3mWHx6bkqRjJVI2LHhR0dC2JAT uUcIQOh1qwHHfDA0eFro59k7QAXLmlJCG48+sEgYl6NUPOAM6hssu7hyFsbn1AunBE ulVgM0hWBaA8Cc9RE1zlKO7LBKCU7jpD+YF3El/0N65MbbaO70PO0vVD4iV6iycH09 0AOFpWYEqpdo4uC+Y4zB63yR92hwdXHXKzx7i+OxiZ6X/wtBKrThQDJUHDbjuq9+/A 4Jmo519NCMuGA== Message-ID: Date: Wed, 24 May 2023 18:49:22 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v4 02/15] locale/programs/locarchive.c: fix warn unused result Content-Language: en-US To: =?UTF-8?B?RnLDqWTDqXJpYyBCw6lyYXQ=?= , libc-alpha@sourceware.org References: <20230428122142.928135-1-fberat@redhat.com> <20230428122142.928135-3-fberat@redhat.com> From: Siddhesh Poyarekar In-Reply-To: <20230428122142.928135-3-fberat@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3037.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-04-28 08:21, Frédéric Bérat wrote: > Changes since v2: > - Freeing normalized_codeset before returning. > > Changes since v3: > - Rebased on master > --8<-- > > Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in > glibc. > --- > locale/programs/locarchive.c | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) LGTM. Reviewed-by: Siddhesh Poyarekar PS: Put the bits you don't want in the git commit (e.g. the changelog for your patch) after the --- above. I've never been able to get the scissors to work correctly. > > diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c > index 8d7d51af6c..71fd9f34fa 100644 > --- a/locale/programs/locarchive.c > +++ b/locale/programs/locarchive.c > @@ -1154,10 +1154,14 @@ add_locale_to_archive (struct locarhandle *ah, const char *name, > if (mask & XPG_NORM_CODESET) > /* This name contains a codeset in unnormalized form. > We will store it in the archive with a normalized name. */ > - asprintf (&normalized_name, "%s%s%s.%s%s%s", > - language, territory == NULL ? "" : "_", territory ?: "", > - normalized_codeset, > - modifier == NULL ? "" : "@", modifier ?: ""); > + if (asprintf (&normalized_name, "%s%s%s.%s%s%s", > + language, territory == NULL ? "" : "_", territory ?: "", > + normalized_codeset, > + modifier == NULL ? "" : "@", modifier ?: "") < 0) > + { > + free ((char *) normalized_codeset); > + return -1; > + } > > /* This call does the main work. */ > locrec_offset = add_locale (ah, normalized_name ?: name, data, replace); > @@ -1188,10 +1192,14 @@ add_locale_to_archive (struct locarhandle *ah, const char *name, > normalized_codeset = _nl_normalize_codeset (codeset, strlen (codeset)); > mask |= XPG_NORM_CODESET; > > - asprintf (&normalized_codeset_name, "%s%s%s.%s%s%s", > - language, territory == NULL ? "" : "_", territory ?: "", > - normalized_codeset, > - modifier == NULL ? "" : "@", modifier ?: ""); > + if (asprintf (&normalized_codeset_name, "%s%s%s.%s%s%s", > + language, territory == NULL ? "" : "_", territory ?: "", > + normalized_codeset, > + modifier == NULL ? "" : "@", modifier ?: "") < 0) > + { > + free ((char *) normalized_codeset); > + return -1; > + } > > add_alias (ah, normalized_codeset_name, replace, > normalized_name ?: name, &locrec_offset);