From nobody Sun Jun 25 23:57:33 2023 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 4Qq7FT2mSXz4hn7F; Sun, 25 Jun 2023 23:57:33 +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 4Qq7FT2M9bz40Fp; Sun, 25 Jun 2023 23:57:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687737453; 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=LAHx/pEcIh4gqES/hsp/J4pyarWOn8ymYFv/2lGjQK8=; b=pGG+LJQd1D3F6P8V0CBGqf8RNuwheQNZf5mcsmtJghwO7P2CmX67jtRcK7kkd7Cro65iA1 brSxMLYXCtD/YimXJb7QMDGst/z6+qCNRTDE+kO0cCauZHyMbpMCjkWGgPyVm0P/2wN5AO ZEpbWduy9iYn7ymQsl0m+/egXDvMP6U05nRjhnKkpktoAOSgwuK7i+SOHcSU9wavNOugKD 6J3wKe3syzjMjPIUwXQemvjOgpNSYMX+AzopH+dIf4mcEPwc0pAThM3X8fuQpuf3ixdZZh i50SeQ8+OgmY9CfBdseLzZqshdeAw3bdUc7nb/QLFiAdgI1MMgzUyxX/IIPH4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687737453; 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=LAHx/pEcIh4gqES/hsp/J4pyarWOn8ymYFv/2lGjQK8=; b=DuFqGNWJTuwGhkJCnXXhy+znhdRDOWHhM/Azt2xteTdvE4xYf1+DsetI9xA3QaU+DWzEZt 3HLK+aVfX4m9eKqDx8ARmravn5D1dbwFrhhtTpK1UlVVEnH39x5TLcf7KraDWTqyDwDYf/ lrbufc8bh+WDNy4F9gNbKs6rynMB1POKgJ1g1N8nPZO5avq9aEEh9DxaZpLuA18ZHSCb8t KcnAu9Wv9of1MzlcTZNNwwbJqaxVL1tdvChFVgUPTISzacUuSd8HEfG8PY8gSQ7tfVAr/z yqacPntvhLS/h1Kw/uZ/BvznaH8haWQ6dbpncIybhcV20/fsI4oDJdI7dViJ8g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687737453; a=rsa-sha256; cv=none; b=t5FN32ih+dtPJXe5FGe/Hr0f/UGqYt2umVkXuCzMaGkwry1VushgOBWA7BOvEDe96tB5Zl CYtRXolUy+uZHnqDYus7dS7oL5V1s8DjBA/3xkyRRBAWbXHEBLZaa4G37ir1DyjDb3MlnH 80xEyVSNRcQmvUpJRa/v7K7jpxwWcDO+dtPclm2LGlV2SKp4cmyeIu0bsm50SHKRiT512j DUQWhwbKZCEe5HzAkU1m5V06jbWrbnCodWg6NVtL4dhKx93l4gqsUC7hajssih4aD7Qv9W afDt3JN+eG7+ug2PeoBAWEhplXUGH+R/wI47cPVJha9pFDblQ07U0fD6oRxXUA== 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 4Qq7FT1Q0fznTb; Sun, 25 Jun 2023 23:57:33 +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 35PNvXIG073245; Sun, 25 Jun 2023 23:57:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35PNvX4w073244; Sun, 25 Jun 2023 23:57:33 GMT (envelope-from git) Date: Sun, 25 Jun 2023 23:57:33 GMT Message-Id: <202306252357.35PNvX4w073244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 5dae8905a514 - main - seq: combine asprintf return value checks 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5dae8905a5141e0cba1f4f3f94116440a5ce2abb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5dae8905a5141e0cba1f4f3f94116440a5ce2abb commit 5dae8905a5141e0cba1f4f3f94116440a5ce2abb Author: Ed Maste AuthorDate: 2023-06-19 02:10:32 +0000 Commit: Ed Maste CommitDate: 2023-06-25 23:57:17 +0000 seq: combine asprintf return value checks Error handling is identical for all of these failure cases. Sponsored by: The FreeBSD Foundation --- usr.bin/seq/seq.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/usr.bin/seq/seq.c b/usr.bin/seq/seq.c index 3618a106ec9e..d1d2cfbf17ed 100644 --- a/usr.bin/seq/seq.c +++ b/usr.bin/seq/seq.c @@ -198,13 +198,9 @@ main(int argc, char *argv[]) * equal, it means the exit condition of the loop held true due to a * rounding error and we still need to print 'last'. */ - if (asprintf(&cur_print, fmt, cur) < 0) { - err(1, "asprintf"); - } - if (asprintf(&last_print, fmt, last) < 0) { - err(1, "asprintf"); - } - if (asprintf(&prev_print, fmt, prev) < 0) { + if (asprintf(&cur_print, fmt, cur) < 0 || + asprintf(&last_print, fmt, last) < 0 || + asprintf(&prev_print, fmt, prev) < 0) { err(1, "asprintf"); } if (strcmp(cur_print, last_print) == 0 &&