From nobody Sun Sep 22 16:55:15 2024 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 4XBXLC44Tnz5XTw2; Sun, 22 Sep 2024 16:55:15 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XBXLC3Jx0z4DJP; Sun, 22 Sep 2024 16:55:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727024115; 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=DY5MdB5iMKIVM02lwJ39H1k3h4InOjW/aj6wfaE9Aak=; b=qrNofJM7NoV601uIMlT++RjejXBpyxnVPd7B4rmkkohjqurqkhpp05ALYnOXrcwXM5Vhqj jr6ttKofjwyxnW33w0Hd1B61CIbIQ80hiqHY9mCjUnEfcixsFqP9zcvvTzTMCNb1MMvKTy WMVXdPQD/SViYBcYL9dSpsABAZv+N5q89LcAq2pMwBrwUj14BC/m1Souu8cZOYQCB4TdB0 tmyAUskSU+dc7+y04j9m7XCLLZRZ7MOA3I/fzNio3ND98gaYjxZe0mJa4kWsRk8aEBxHmN /LE0p9Gm2+F3Lk8VD3+mfR0YEWQW0PYnJgpEoJQDnJf0kf0z8JhiyCuJ3OugKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727024115; a=rsa-sha256; cv=none; b=WgAt2Jvxqv5RbpNu+vE6pLnnVQ0U2vc5mIHB9BoxodKaKyLZ9LeyL72tr11CPLBDMlzIvE P+RrofunoxEUL8q5IFh2Pr/EWJtmPxZRFsRWoHR4jnZehW8JLKwyYiS8AYOABQ4eP2atux vWQK3QxP94qwMEABEPhi6Ze0baNoGATvfl4QmWfX9c5J+xuTCjnTv0tyumlLW7/KG7PwAz Iub9gwFpch2k3GjOwwas1kCEFcY6JV/0bCou4g8FxFUtpjtcNf2TAnFgSmkTdgML3j3nY9 BcLo4++H/WfF1xMuRi9ntQjLWPEybFN6vzxSJhm1R125M+tER1CI3eFAhasazQ== 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=1727024115; 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=DY5MdB5iMKIVM02lwJ39H1k3h4InOjW/aj6wfaE9Aak=; b=yew7dFyckiL2gtURa4ZUCtVGS97xCL89Tn2AsZ79/SZOmRrM6JEUfaay44Pp6ADDXgwHDF PO51oFuux+bgbFCvZN1bn+XtF1dL24LhcaWvaAj+O0IktPDN72WkCF6LqfmpcTI5Cimug/ zYZfoo12OpLHSJbYGYT7lHeMACjRc70/MOMGWysSjoxq9v7WZxuQKFGSjXR3Yqfa8JiCFz wJ96pEEJedmu5fnZ907ktCZQSmeSvAObdU1t/Ea9qpBGCOCSsShLPmi97KITf7ytPvLV0j HGF9nb+UzZiEqdV5rO6GjaKOs4/xa6+i0rRNe+Nnrg9P2eWnC30kCQaiV2OrUA== 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 4XBXLC2w0Gz1Nlj; Sun, 22 Sep 2024 16:55:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48MGtFTU050866; Sun, 22 Sep 2024 16:55:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48MGtFuC050863; Sun, 22 Sep 2024 16:55:15 GMT (envelope-from git) Date: Sun, 22 Sep 2024 16:55:15 GMT Message-Id: <202409221655.48MGtFuC050863@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f5a8f6f71a68 - main - rtld: Catch up to 07d90ee0a621 in subr_prf.c: Fix '+' conversion handling 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5a8f6f71a6845ad2eb3d8db22789ba6b1fd3fd8 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f5a8f6f71a6845ad2eb3d8db22789ba6b1fd3fd8 commit f5a8f6f71a6845ad2eb3d8db22789ba6b1fd3fd8 Author: Warner Losh AuthorDate: 2024-09-22 16:49:45 +0000 Commit: Warner Losh CommitDate: 2024-09-22 16:52:11 +0000 rtld: Catch up to 07d90ee0a621 in subr_prf.c: Fix '+' conversion handling Sponsored by: Netflix --- libexec/rtld-elf/rtld_printf.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/libexec/rtld-elf/rtld_printf.c b/libexec/rtld-elf/rtld_printf.c index 45c0bdc00b29..69ee4e46fd1c 100644 --- a/libexec/rtld-elf/rtld_printf.c +++ b/libexec/rtld-elf/rtld_printf.c @@ -125,9 +125,9 @@ kvprintf(char const *fmt, struct snprintf_arg *arg, int radix, va_list ap) char nbuf[MAXNBUF]; const char *p, *percent, *q; u_char *up; - int ch, n; + int ch, n, sign; uintmax_t num; - int base, lflag, qflag, tmp, width, ladjust, sharpflag, neg, sign, dot; + int base, lflag, qflag, tmp, width, ladjust, sharpflag, dot; int cflag, hflag, jflag, tflag, zflag; int dwidth, upper; char padc; @@ -150,7 +150,7 @@ kvprintf(char const *fmt, struct snprintf_arg *arg, int radix, va_list ap) PCHAR(ch); } percent = fmt - 1; - qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; neg = 0; + qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; sign = 0; dot = 0; dwidth = 0; upper = 0; cflag = 0; hflag = 0; jflag = 0; tflag = 0; zflag = 0; reswitch: switch (ch = (u_char)*fmt++) { @@ -161,7 +161,7 @@ reswitch: switch (ch = (u_char)*fmt++) { sharpflag = 1; goto reswitch; case '+': - sign = 1; + sign = '+'; goto reswitch; case '-': ladjust = 1; @@ -242,7 +242,6 @@ reswitch: switch (ch = (u_char)*fmt++) { case 'd': case 'i': base = 10; - sign = 1; goto handle_sign; case 'h': if (hflag) { @@ -291,8 +290,10 @@ reswitch: switch (ch = (u_char)*fmt++) { goto reswitch; case 'r': base = radix; - if (sign) + if (sign) { + sign = 0; goto handle_sign; + } goto handle_nosign; case 's': p = va_arg(ap, char *); @@ -329,13 +330,11 @@ reswitch: switch (ch = (u_char)*fmt++) { goto handle_nosign; case 'y': base = 16; - sign = 1; goto handle_sign; case 'z': zflag = 1; goto reswitch; handle_nosign: - sign = 0; if (jflag) num = va_arg(ap, uintmax_t); else if (qflag) @@ -370,11 +369,11 @@ handle_sign: num = (signed char)va_arg(ap, int); else num = va_arg(ap, int); -number: - if (sign && (intmax_t)num < 0) { - neg = 1; + if ((intmax_t)num < 0) { + sign = '-'; num = -(intmax_t)num; } +number: p = ksprintn(nbuf, num, base, &n, upper); tmp = 0; if (sharpflag && num != 0) { @@ -383,7 +382,7 @@ number: else if (base == 16) tmp += 2; } - if (neg) + if (sign) tmp++; if (!ladjust && padc == '0') @@ -393,8 +392,8 @@ number: if (!ladjust) while (width-- > 0) PCHAR(' '); - if (neg) - PCHAR('-'); + if (sign) + PCHAR(sign); if (sharpflag && num != 0) { if (base == 8) { PCHAR('0');