chown/chgrp: chown target not symlink by default

chown on a symlink should only chown the symlink itself when -h
is specified, when no options are provided the target should be chown'd.
master
Richard Ipsum 4 years ago committed by Michael Forney
parent a0fae71977
commit dc77c5968b

@ -18,7 +18,7 @@ chgrp(const char *path, struct stat *st, void *data, struct recursor *r)
char *chownf_name;
int (*chownf)(const char *, uid_t, gid_t);
if (r->follow == 'P' || (r->follow == 'H' && r->depth) || (hflag && !(r->depth))) {
if ((r->maxdepth == 0 && r->follow == 'P') || (r->follow == 'H' && r->depth) || (hflag && !(r->depth))) {
chownf_name = "lchown";
chownf = lchown;
} else {

@ -21,7 +21,7 @@ chownpwgr(const char *path, struct stat *st, void *data, struct recursor *r)
char *chownf_name;
int (*chownf)(const char *, uid_t, gid_t);
if (r->follow == 'P' || (r->follow == 'H' && r->depth) || (hflag && !(r->depth))) {
if ((r->maxdepth == 0 && r->follow == 'P') || (r->follow == 'H' && r->depth) || (hflag && !(r->depth))) {
chownf_name = "lchown";
chownf = lchown;
} else {

Loading…
Cancel
Save