From cc8660c75be5648df971cb25a3728c40f1ca819a Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Sat, 29 Jul 2000 22:22:11 +0000 Subject: [PATCH] Initialize vflag like the rest (not necessary, but this keeps it together) Optimize out chown(2) syscalls if there is no change in uid or gid. --- usr.sbin/chown/chown.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.sbin/chown/chown.c b/usr.sbin/chown/chown.c index 26d307396586..dacf623bb06a 100644 --- a/usr.sbin/chown/chown.c +++ b/usr.sbin/chown/chown.c @@ -85,7 +85,7 @@ main(argc, argv) myname = (cp = rindex(*argv, '/')) ? cp + 1 : *argv; ischown = myname[2] == 'o'; - Hflag = Lflag = Pflag = hflag = 0; + Hflag = Lflag = Pflag = hflag = vflag = 0; while ((ch = getopt(argc, argv, "HLPRfhv")) != -1) switch (ch) { case 'H': @@ -182,6 +182,9 @@ main(argc, argv) default: break; } + if ((uid == -1 || uid == p->fts_statp->st_uid) && + (gid == -1 || gid == p->fts_statp->st_gid)) + continue; if (hflag) { if (lchown(p->fts_accpath, uid, gid) && !fflag) { chownerr(p->fts_path);