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
This commit is contained in:
Goran Mekic 2022-11-22 09:53:20 +01:00 committed by Kristof Provost
parent b8a0dfb17e
commit 3599da158e

View file

@ -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;