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.
This commit is contained in:
parent
a0fae71977
commit
dc77c5968b
2
chgrp.c
2
chgrp.c
@ -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 {
|
||||
|
2
chown.c
2
chown.c
@ -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…
Reference in New Issue
Block a user