From nobody Fri Jun 6 13:00:03 2025 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 4bDLyC4hnNz5x5rC; Fri, 06 Jun 2025 13:00:03 +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 4bDLyC2xf8z3FQW; Fri, 06 Jun 2025 13:00:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749214803; 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=Jb+7DVm9+mXm/4np6ZHgv4Cdz1C8z69cU1sqF72D52E=; b=hz7V4kTkVNeh73sB1EJR3wSagFjVEjuJYMCWKiPdPjzegbxD3esqFCrYYkgo6c70ds9zVM lWB65UyeCDaQsILkwiXYu3/FE53i4rlqubd4OZEaWo+CbbC6m1lS2JeciFJGfDNF/2uJb/ lEZCCEdf1RDF6nt255Y8m/6zmHMgGESflg1ymp4WEl6J3jobq9fBRbuOe6N6BjqbtaRKwE eP9yUDxVoKbxjH9ThN7J8IiXXfkz+JrOZ9nF1noFANH7f4Ko4ds0YvwunvlLltHy2hVOyu XzHIoMUY8yiY2cnWgfCjLVj2dcifQT81iUq6X58SNjeJMXPQMahdw6UA9n4kgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749214803; 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=Jb+7DVm9+mXm/4np6ZHgv4Cdz1C8z69cU1sqF72D52E=; b=xb9/7Z+A8ntWxGVS4iOnajzQeFS9x462xD8lPB3QxTg5WB0ZeiLY7dhtkC5VRpAGo5cb9A IC51i3NDbaeLV+i5msJbgzGaeWy8UMZ8JvV5PHBzex2j+MAAJJuRh8MM90t6G2b4GcSwVV 0sX4wYAp7q6yk/CEHx0OZAqzcXK4kbj4oM7h3K/oMHGJco8Rn5qY7cQ91ISwjPz9eKIZ2m hJHXHJ9jbWl5+KKTSo+sVubfopnywZM/LXDd3QoKNO8vLuRw/JONfH4pWESLWp/QbuzL5C xY5vNs+4yv+BTXmaCWkuC5lbPY1WBe4wIAsR7sCJT3iFFyhTywBfPvWf7XQnVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1749214803; a=rsa-sha256; cv=none; b=Rfl3cxlts/QQciMhDxMoIw7rnv3f8dXoJCxFVOk4xcUGG7BEElBbJ87NpT5gW9/vBDAl4U Jpmq4PnpSvY5cC5wWTkKYc+4iZMBX37Bu7zF7Q3Y5m3WnCRnXoukmgUC3wQNryzYlXp+xn PUQ1jVw/ZzZsxnM2yLwqcuo6s0RO+8ArbTp8g5jzAGWNkg7sO0kqbstqq7wBUpU10aOYJs r2TJX0BuWYXJ7H1iBDxAtGQ0EhPBcRewS3F4OIm3cNnCKHRnUfmKRTK4Ca62zsEmlDsk3Z ESgaBFJa6hLtEYEElQHjw9zd4NsaeDA9wkbv9qZOcNhO27jv0qFX+tx0Tlxfjg== 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 4bDLyC2Gjnzvyt; Fri, 06 Jun 2025 13:00:03 +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 556D03fQ075483; Fri, 6 Jun 2025 13:00:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 556D03Ug075477; Fri, 6 Jun 2025 13:00:03 GMT (envelope-from git) Date: Fri, 6 Jun 2025 13:00:03 GMT Message-Id: <202506061300.556D03Ug075477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: feac17714fdf - main - pfctl: void functions and exit(3) on error 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: feac17714fdf23d8cda5c552d6edd8e12ff9a43f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=feac17714fdf23d8cda5c552d6edd8e12ff9a43f commit feac17714fdf23d8cda5c552d6edd8e12ff9a43f Author: Kristof Provost AuthorDate: 2025-05-29 12:28:54 +0000 Commit: Kristof Provost CommitDate: 2025-06-06 12:59:47 +0000 pfctl: void functions and exit(3) on error Changes: voided: - pfctl_do_clear_tables - pfctl_show_tables - pfctl_show_ifaces Those functions now exit(3) in case of error instead of passing it up to the callers (where it was ignored). OK mikeb@, sashan@ Obtained from: OpenBSD, awolk , c5e9690e42 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.h | 6 +++--- sbin/pfctl/pfctl_table.c | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index b4f8c97854d1..7df56499ea16 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -81,13 +81,13 @@ int pfi_get_ifaces(const char *, struct pfi_kif *, int *); int pfi_clr_istats(const char *, int *, int); void pfctl_print_title(char *); -int pfctl_do_clear_tables(const char *, int); -int pfctl_show_tables(const char *, int); +void pfctl_do_clear_tables(const char *, int); +void pfctl_show_tables(const char *, int); int pfctl_command_tables(int, char *[], char *, const char *, char *, const char *, int); int pfctl_show_altq(int, const char *, int, int); void warn_namespace_collision(const char *); -int pfctl_show_ifaces(const char *, int); +void pfctl_show_ifaces(const char *, int); void pfctl_show_creators(int); FILE *pfctl_fopen(const char *, const char *); diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index 834f74811ea2..f23a62f518e1 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -104,16 +104,18 @@ static const char *istats_text[2][2][2] = { table.pfrt_flags &= ~PFR_TFLAG_PERSIST; \ } while(0) -int +void pfctl_do_clear_tables(const char *anchor, int opts) { - return pfctl_table(0, NULL, NULL, "-F", NULL, anchor, opts); + if (pfctl_table(0, NULL, NULL, "-F", NULL, anchor, opts)) + exit(1); } -int +void pfctl_show_tables(const char *anchor, int opts) { - return pfctl_table(0, NULL, NULL, "-s", NULL, anchor, opts); + if (pfctl_table(0, NULL, NULL, "-s", NULL, anchor, opts)) + exit(1); } int @@ -644,7 +646,7 @@ xprintf(int opts, const char *fmt, ...) /* interface stuff */ -int +void pfctl_show_ifaces(const char *filter, int opts) { struct pfr_buffer b; @@ -657,7 +659,7 @@ pfctl_show_ifaces(const char *filter, int opts) b.pfrb_size = b.pfrb_msize; if (pfi_get_ifaces(filter, b.pfrb_caddr, &b.pfrb_size)) { radix_perror(); - return (1); + exit(1); } if (b.pfrb_size <= b.pfrb_msize) break; @@ -666,7 +668,6 @@ pfctl_show_ifaces(const char *filter, int opts) pfctl_print_title("INTERFACES:"); PFRB_FOREACH(p, &b) print_iface(p, opts); - return (0); } void