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.
This commit is contained in:
parent
1510e9e7c6
commit
cc8660c75b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user