git: 3599da158e39 - main - ipfw: Fix ipfw/dnctl detection
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Nov 2022 09:41:16 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3599da158e392ed1dd86bd3363d8bd014cf4da08 commit 3599da158e392ed1dd86bd3363d8bd014cf4da08 Author: Goran Mekic <meka@tilda.center> AuthorDate: 2022-11-22 08:53:20 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2022-11-22 08:53:20 +0000 ipfw: Fix ipfw/dnctl detection Running "dnctl" vs "/sbin/dnctl" gave different results, because we looked at the entire argv[0] string, rather than the basename. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D37431 --- sbin/ipfw/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/ipfw/main.c b/sbin/ipfw/main.c index 1b9c7f324a9c..577224047cd0 100644 --- a/sbin/ipfw/main.c +++ b/sbin/ipfw/main.c @@ -30,6 +30,7 @@ #include <string.h> #include <sysexits.h> #include <unistd.h> +#include <libgen.h> #include "ipfw2.h" @@ -682,7 +683,7 @@ main(int ac, char *av[]) } #endif - if (strcmp(av[0], "dnctl") == 0) + if (strcmp("dnctl", basename(av[0])) == 0) g_co.prog = cmdline_prog_dnctl; else g_co.prog = cmdline_prog_ipfw;