From nobody Tue Apr 23 19:44:26 2024 X-Original-To: dev-commits-src-all@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 4VPCHb1BBmz5Hx6D; Tue, 23 Apr 2024 19:44:27 +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 4VPCHZ5TP7z4gsR; Tue, 23 Apr 2024 19:44:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713901466; 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=EuE0weCK1Yv/KfFwSMIc2/wT122P/Jp2dgLr0TkXkok=; b=C07KmjFSZsOArivrPyoIlp86QG1NSuHFniwQrUxyYOXW0o2h6bS9eJoZiBZiRK180aM6u/ 4tDWBxZRXLCBdMNmmkkwWr5fhdxGhUvWd6AzAP73HcC0A1RilwjUi0BoGkpv4wBF91N35q e4POYkdRbmwNedHwS5WwDwApnNfsDwuD+F3mwlDW3hxhXV4yioUM2enkUF9RT7uGid0Lcw qBqE3X0MJHJK8gHfBeZQHhFHCXnPGfbnpVOqCUghYD7fkiDwOb1s4Iq/YFuAnjfJ/vopEQ uu5qDIP7KknmZJu0qSbKNLWrJJEk/DEqkB4k0HDay6luxyzyE/Rcn2kR3zykTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713901466; a=rsa-sha256; cv=none; b=dGxIT4dNzEHrO8k78H3aHJR1Ck9zqoRYeLKouKcK+VLpBHe8Cd0u/EplKBOKYclSEmMjkk P5NsF0pkgGRt+SB5tMTCUh5b9umFLYsBjtM8kJuoS/u22EVqv3B2Fr0hiYUs+Q8m2crdph csbz28PKhe0mUeET2EOnDYQhy7ASfCcjj2lnsiGwckvYMq8xdxrIpX5q8SmlwDzLMgqV9e HwrxidRBWTlwvWrU3V+HYyepfbGKB6Vtt5i03duZcgB9r9TRfbGZGw4Qm5We+sJNvfCc4O i5gdGeeEl/yBvN/QGu6f7gsrDrwHyTFIo+/pv9WftNGkwgVh9nX3jMybWPLFZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713901466; 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=EuE0weCK1Yv/KfFwSMIc2/wT122P/Jp2dgLr0TkXkok=; b=lkYHsnZh5wNDnM84XC57v3VUkpdND02m9AlTspu1FCimDTAOFYjSuczaBB+HXQ1fOivJm6 LcyFVPFFqZ6jRqF6nEVn2n9msJEndlfLhlnI/Htj7iYwvxZRTgCgnHCR3EDELjnUy2AAzl T5LnpfY+qi4RpR6GSkq6OqN8g3v2ZqjchxVEDGLWAefOUs/vVTm8NYUBNJLgQSw+4zLipy M0jxq3aFNEyXSXHqNYJLmCM2dBp3BkgRjsOQJmY0SHEAvWlW33X0VM6qz9kD1T04/nd++9 +ZWnxPCpYfT3yYj63PWUdTnvJdSh/1vFwBNXaN6uoWpYn8eOBkyQ5xvrlJ0jIg== 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 4VPCHZ53mxzlLP; Tue, 23 Apr 2024 19:44:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43NJiQKl077647; Tue, 23 Apr 2024 19:44:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43NJiQfJ077644; Tue, 23 Apr 2024 19:44:26 GMT (envelope-from git) Date: Tue, 23 Apr 2024 19:44:26 GMT Message-Id: <202404231944.43NJiQfJ077644@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: aa66995b4c80 - main - libc printf_render_errno(): do not use strerror() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: aa66995b4c804cbb579f71645d97fe282a798bfc Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=aa66995b4c804cbb579f71645d97fe282a798bfc commit aa66995b4c804cbb579f71645d97fe282a798bfc Author: Konstantin Belousov AuthorDate: 2024-04-23 17:15:22 +0000 Commit: Konstantin Belousov CommitDate: 2024-04-23 19:44:07 +0000 libc printf_render_errno(): do not use strerror() Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44916 --- lib/libc/stdio/xprintf_errno.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libc/stdio/xprintf_errno.c b/lib/libc/stdio/xprintf_errno.c index c63a7afd35e0..f1e5421f60c8 100644 --- a/lib/libc/stdio/xprintf_errno.c +++ b/lib/libc/stdio/xprintf_errno.c @@ -27,6 +27,7 @@ */ #include +#include #include #include #include @@ -53,13 +54,13 @@ __printf_render_errno(struct __printf_io *io, const struct printf_info *pi { int ret, error; char buf[64]; - const char *p; + char errnomsg[NL_TEXTMAX]; ret = 0; error = *((const int *)arg[0]); if (error >= 0 && error < __hidden_sys_nerr) { - p = strerror(error); - return (__printf_out(io, pi, p, strlen(p))); + strerror_r(error, errnomsg, sizeof(errnomsg)); + return (__printf_out(io, pi, errnomsg, strlen(errnomsg))); } sprintf(buf, "errno=%d/0x%x", error, error); ret += __printf_out(io, pi, buf, strlen(buf));