From nobody Thu Feb 03 02:49:28 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AE71119A0A3E; Thu, 3 Feb 2022 02:49:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jq36K1FJ9z4bDf; Thu, 3 Feb 2022 02:49:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643856569; 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; bh=ho7zI1xDArJZNK8sr5T11YEoMECDTN/kp4D4+O2mqPs=; b=l0NCiKEB5tHFYuIV7ahhlOOcyBhLfEDkskxVmwtdgGJYsa5tNp/GkOF9bDjsRZ9OM39XEz ziy+SI6QanAopT0beQmhH5ZsTSguCkk5ZWBe4Ltmk0ruBFKvSiM7vnwykV8SxihsTewdzr VxsfQh35X/sEf7HWiXqLbjkAwu2XyUtw3YtdKv6q3eZLa7Bx2MV4lgh7tKuT23Lk4LhH4/ sPJbhRy1EEfLdVH0Hb3/esIPAk3h2kuBUPYGft86RZT1wXwqSuWZShM9ScDvQoCI8XPeYS 4iO56ByspzDz63GvmJnuPur3CpuhelaJZnXKQJnlZ744tXwLKyqJ0J3XEYlQ9Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFA437C7F; Thu, 3 Feb 2022 02:49:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2132nSUI087000; Thu, 3 Feb 2022 02:49:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2132nSs1086999; Thu, 3 Feb 2022 02:49:28 GMT (envelope-from git) Date: Thu, 3 Feb 2022 02:49:28 GMT Message-Id: <202202030249.2132nSs1086999@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7bf532c9d447 - main - xlocale.c: only call init_key() when locale was successfully allocated List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7bf532c9d447bfdf03f42a5c5092fb74740722b2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643856569; 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; bh=ho7zI1xDArJZNK8sr5T11YEoMECDTN/kp4D4+O2mqPs=; b=sEwtLITXfyp1UI18MDj9OPe7DcbKuut9odHDiQGNpMq6djZD4yxcLTnqD6Bmlagd+Vdm0i AhOq08b5EBMCnL3qOvXQe2KLq3oEF26vNE4OjZ/Or94WwqAKCEOhjQExkU9vsxBlBN8rv7 htbOHbZPwduVpqwfsFYd/uVHsTxJLtL5RRL7LuCjpzA6qARzEpFbMNQeCXfdyPG3LcjBgM NL5nqByWkAgTwulerIfF7pNmADadWXR3kAto0BnvoaC7LFIFF3aC1MWYtfsUTa9USTsLKi 8afsxC/Rm4gco37tSxYCE85uRb567Q8qhwFPp9Fjz71EKHxj5nXfcEJD4LxQ2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643856569; a=rsa-sha256; cv=none; b=ennAxYOYPqinACse08FOqci3/JP0cw6t8/oCV53oL8KOdGexj/KKqF3AtWUixiByAtkAce 0LQNKXekko27j3edaXlPJQgB8cBc3lKJf06IT0uU1AUobY7ZIqKcRTGXO1j/AhvxfpHbn7 J+yNEIu45DVdj/VLSh13lDhoixZJSb6Ms8hb5NkQq7YVkdx4GDzJ9sAPGz6vOj5NG8O00j 7iDzdDCbi8c6Z2dnCZlea/DiKe7/o2N7Vflw6P69b3Kk3Qk4Jq1aFfa6Nv7EC4jqi4OxeU VCnX6PUwwfbsUcPm8R4lqcDFR6lHDL1aiKEf4jWmUpE2Oxrb6QST6T9lXDKO4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7bf532c9d447bfdf03f42a5c5092fb74740722b2 commit 7bf532c9d447bfdf03f42a5c5092fb74740722b2 Author: Konstantin Belousov AuthorDate: 2022-02-02 17:25:45 +0000 Commit: Konstantin Belousov CommitDate: 2022-02-03 01:02:59 +0000 xlocale.c: only call init_key() when locale was successfully allocated Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34140 --- lib/libc/locale/xlocale.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/locale/xlocale.c b/lib/libc/locale/xlocale.c index 467d6e6e5aee..4bddc43c086b 100644 --- a/lib/libc/locale/xlocale.c +++ b/lib/libc/locale/xlocale.c @@ -257,13 +257,13 @@ newlocale(int mask, const char *locale, locale_t base) int useenv = 0; int success = 1; - _once(&once_control, init_key); - locale_t new = alloc_locale(); if (NULL == new) { return (NULL); } + _once(&once_control, init_key); + orig_base = base; FIX_LOCALE(base); copyflags(new, base); @@ -312,12 +312,12 @@ duplocale(locale_t base) locale_t new = alloc_locale(); int type; - _once(&once_control, init_key); - if (NULL == new) { return (NULL); } + _once(&once_control, init_key); + FIX_LOCALE(base); copyflags(new, base);