From nobody Wed Jul 15 13:50:36 2026 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 4h0cy514Rnz6lW1l for ; Wed, 15 Jul 2026 13:50:37 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h0cy45PXQz3WQ3 for ; Wed, 15 Jul 2026 13:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784123436; 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=wC+m69aGE85AQO+RnomEx8oAk6BPNuTAMUYt/Cr+I1I=; b=IV/pt/NsrPiKv+YpUuWSicRZUtQKA5a8OcAIkHWc3VXIEU6shWPOZaZxkW6dO/VhASLj5e eUR8npbnTH5cJuLIMKK0ib3/2myi18tgn/ZbTH/9q0PYUvk6BiLb0z68OsvnP95nU+lW4S KHtjwQheJZo5g2JA1cgLvtceA9uT6UsMStSLkbTt7jRJeLeV40TomAlD7A9ia2bT4uMO6E 7D9puuUw+Ii1UAynfDy8adfCjYtRD0pvhQABwMBddQPJzmmikEqoUi52Yoeb71pkaACpop i5Rn27wokGgy8nDig9/mWE5bMFs7NIT7wrfOfOxyH9Z66896Yc1uEULSL393wA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784123436; a=rsa-sha256; cv=none; b=bQAX0WcMCxZgSydtSsyjsNOjPYRr2pu8uNETtj0UAnnn5wzq972G+5A9A/KadaR75fW9uD BLt7RxRjM9MTaUQ0/etpPs6qCt8Z13AyQdkaTuuCKRqBA3iroiF7cYBt7g91uavpTYjXrU 90K2ff3voq0dYA8EenO9lbnw/17kZbiCnF2/1YXfiMfS3DHWqfJKK/8U/Qm5zvzDDIeGv+ HQhdsaLW0mRfEb3VAygUfnRLh6cZ+5hUo8yRbJd616qZn0lVqXjj4PxviJnOS/TNRZMW1E N08o5h1PuaWnEITFBoa0dI1dFCUIbV0ISBQjuPJUgA/7DRJ8sgAzCszSfkN4Cg== 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=1784123436; 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=wC+m69aGE85AQO+RnomEx8oAk6BPNuTAMUYt/Cr+I1I=; b=ZQDiROwYZS51jM57uBY0ck6hdOa+wdsKvJ6oNPcy4TUaZiWKcbjpiR3FvecWSnD8LRSeQQ o4BfU5ddk9lpoMtqM7kfla8BNxmjfh6B1wPO6o1OkAMvDbitJg56OekLbzs3ByE5gDMTsq nBg9fwhpjirpCxAlnCsl1RCuLItvTkgxh3C1MVs9B6wn/eSAoLokQdl8EpWiPfZ4lPFNKH Rb8SFTUkSKfOOs2wHKWeXWQoemdAoSRQpBG2su3PGDd4asEkmtboqqV1OdpUZwaHKT8E9r WDLQgmDXnc//urmGTr4p+nDC8jWETvKKyM7c87G6xxeZlKftpudKNontM4ydAg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h0cy44CGCzZxk for ; Wed, 15 Jul 2026 13:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39a27 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 15 Jul 2026 13:50:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 40c611d0939f - main - pfctl: fix incorrect errno 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40c611d0939f187d9a211e9e497291e251deddd3 Auto-Submitted: auto-generated Date: Wed, 15 Jul 2026 13:50:36 +0000 Message-Id: <6a57902c.39a27.7f7735c0@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=40c611d0939f187d9a211e9e497291e251deddd3 commit 40c611d0939f187d9a211e9e497291e251deddd3 Author: Kristof Provost AuthorDate: 2026-07-14 07:32:41 +0000 Commit: Kristof Provost CommitDate: 2026-07-15 11:44:59 +0000 pfctl: fix incorrect errno checks These calls return an error value, they do not set errno. Check their return values. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_table.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index aec02c493f1b..1af1538387c7 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -74,6 +74,17 @@ static const char *istats_text[2][2][2] = { { { "In6/Pass:", "In6/Block:" }, { "Out6/Pass:", "Out6/Block:" } } }; +#define RETTEST(fct) do { \ + int _ret; \ + if ((!(opts & PF_OPT_NOACTION) || \ + (opts & PF_OPT_DUMMYACTION)) && \ + (_ret = (fct) != 0)) { \ + if ((opts & PF_OPT_RECURSE) == 0) \ + warnx("%s", pf_strerror(_ret)); \ + goto _error; \ + } \ + } while (0) + #define RVTEST(fct) do { \ if ((!(opts & PF_OPT_NOACTION) || \ (opts & PF_OPT_DUMMYACTION)) && \ @@ -157,7 +168,7 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command, if (!strcmp(command, "-F")) { if (argc || file != NULL) usage(); - RVTEST(pfctl_clear_tables(pfh, &table, &ndel, flags)); + RETTEST(pfctl_clear_tables(pfh, &table, &ndel, flags)); xprintf(opts, "%d tables deleted", ndel); } else if (!strcmp(command, "-s")) { b.pfrb_type = (opts & PF_OPT_VERBOSE2) ? @@ -192,12 +203,12 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command, } else if (!strcmp(command, "kill")) { if (argc || file != NULL) usage(); - RVTEST(pfr_del_table(&table, &ndel, flags)); + RETTEST(pfr_del_table(&table, &ndel, flags)); xprintf(opts, "%d table deleted", ndel); } else if (!strcmp(command, "flush")) { if (argc || file != NULL) usage(); - RVTEST(pfr_clr_addrs(&table, &ndel, flags)); + RETTEST(pfr_clr_addrs(&table, &ndel, flags)); xprintf(opts, "%d addresses deleted", ndel); } else if (!strcmp(command, "add")) { b.pfrb_type = PFRB_ADDRS; @@ -390,7 +401,7 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command, opts & PF_OPT_USEDNS); } else if (!strcmp(command, "zero")) { flags |= PFR_FLAG_ADDRSTOO; - RVTEST(pfctl_clear_tstats(pfh, &table, &nzero, flags)); + RETTEST(pfctl_clear_tstats(pfh, &table, &nzero, flags)); xprintf(opts, "%d table/stats cleared", nzero); } else warnx("pfctl_table: unknown command '%s'", command);