From 7522ecb37f67280cfd594b2c365130add6c26229 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Thu, 10 Oct 2002 16:37:12 +0000 Subject: [PATCH] Use basename(3) to derive the name of the binary from argv[0]. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Submitted by: green --- usr.sbin/extattr/rmextattr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/extattr/rmextattr.c b/usr.sbin/extattr/rmextattr.c index 79cd163bc1ce..e240232a4f7a 100644 --- a/usr.sbin/extattr/rmextattr.c +++ b/usr.sbin/extattr/rmextattr.c @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -111,7 +112,7 @@ main(int argc, char *argv[]) visbuflen = buflen = 0; visbuf = buf = NULL; - p = strrchr(argv[0], '/'); + p = basename(argv[0]); if (p == NULL) p = argv[0]; if (!strcmp(p, "getextattr")) {