mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 04:43:53 +00:00
Change directory permissions in pre-order.
In this order, it won't try to recurse into a directory for which it doesn't have permission, before changing that permission. This follows an existing behavior in other BSDs, linux, OS X. Obtained from: NetBSD
This commit is contained in:
parent
ff09e23f53
commit
db1a93d4fe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283997
|
@ -162,14 +162,16 @@ done: argv += optind;
|
||||||
atflag = AT_SYMLINK_NOFOLLOW;
|
atflag = AT_SYMLINK_NOFOLLOW;
|
||||||
|
|
||||||
switch (p->fts_info) {
|
switch (p->fts_info) {
|
||||||
case FTS_D: /* Change it at FTS_DP. */
|
case FTS_D:
|
||||||
if (!Rflag)
|
if (!Rflag)
|
||||||
fts_set(ftsp, p, FTS_SKIP);
|
fts_set(ftsp, p, FTS_SKIP);
|
||||||
continue;
|
break;
|
||||||
case FTS_DNR: /* Warn, chmod. */
|
case FTS_DNR: /* Warn, chmod. */
|
||||||
warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
|
warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
|
||||||
rval = 1;
|
rval = 1;
|
||||||
break;
|
break;
|
||||||
|
case FTS_DP: /* Already changed at FTS_D. */
|
||||||
|
continue;
|
||||||
case FTS_ERR: /* Warn, continue. */
|
case FTS_ERR: /* Warn, continue. */
|
||||||
case FTS_NS:
|
case FTS_NS:
|
||||||
warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
|
warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
|
||||||
|
|
Loading…
Reference in a new issue