summaryrefslogtreecommitdiffstats
path: root/usr.sbin/chown
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-12-30 10:16:56 +0000
committerobrien <obrien@FreeBSD.org>2002-12-30 10:16:56 +0000
commit3d65cf2dd140654c90a61bda2eb1cb4783536b9d (patch)
tree69003d27117852c39034346436754b2df6882dbe /usr.sbin/chown
parent41352fb7b20f1a4088848598da8af0e45cd4fd40 (diff)
downloadFreeBSD-src-3d65cf2dd140654c90a61bda2eb1cb4783536b9d.zip
FreeBSD-src-3d65cf2dd140654c90a61bda2eb1cb4783536b9d.tar.gz
Use basename(3).
Diffstat (limited to 'usr.sbin/chown')
-rw-r--r--usr.sbin/chown/chown.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.sbin/chown/chown.c b/usr.sbin/chown/chown.c
index fcc10e9..d737bdb 100644
--- a/usr.sbin/chown/chown.c
+++ b/usr.sbin/chown/chown.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <fts.h>
#include <grp.h>
+#include <libgen.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -79,9 +80,7 @@ main(int argc, char **argv)
int ch, fts_options, rval;
char *cp;
- cp = strrchr(argv[0], '/');
- cp = (cp != NULL) ? cp + 1 : argv[0];
- ischown = (strcmp(cp, "chown") == 0);
+ ischown = (strcmp(basename(argv[0]), "chown") == 0);
Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
OpenPOWER on IntegriCloud