summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Shimmin <tes@sgi.com>2008-09-10 16:19:42 +0000
committerTim Shimmin <tes@sgi.com>2008-09-10 16:19:42 +0000
commit5c74744388acef3d105dce529580d898da81a967 (patch)
tree5d5d49b37cbd9857cb0d940f08716aaa4d59fd40
parent197a34705732dc11e63aad84ad1640e7d3c37a29 (diff)
downloadacl-5c74744388acef3d105dce529580d898da81a967.tar.gz
Fix up tree walking code for handling symlinks etc.
Merge of master-melb:xfs-cmds:32095a by kenmcd. Fix up tree walking code for handling symlinks etc.
-rw-r--r--doc/CHANGES5
-rw-r--r--libmisc/walk_tree.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/doc/CHANGES b/doc/CHANGES
index 828d29a..b1ac1ce 100644
--- a/doc/CHANGES
+++ b/doc/CHANGES
@@ -1,3 +1,8 @@
+2.2.49
+* Fix attr/acl code for handling of recursive walking without following symlinks
+ Patch contributed by Brandon Philips <brandon@ifup.org>.
+ http://oss.sgi.com/archives/xfs/2008-07/msg00162.html
+
2.2.48
* Fix NULL pointer access / segmentation fault in setfacl.
When invoked as ``setfacl -- ...'', setfacl segfaults. Reported
diff --git a/libmisc/walk_tree.c b/libmisc/walk_tree.c
index bd02d9e..b26d7df 100644
--- a/libmisc/walk_tree.c
+++ b/libmisc/walk_tree.c
@@ -93,8 +93,15 @@ static int walk_tree_rec(const char *path, int walk_flags,
have_dir_stat = 1;
}
err = func(path, &st, flags, arg);
- if ((flags & WALK_TREE_RECURSIVE) &&
- (S_ISDIR(st.st_mode) || (S_ISLNK(st.st_mode) && follow_symlinks))) {
+
+ /*
+ * Recurse if WALK_TREE_RECURSIVE and the path is:
+ * a dir not from a symlink
+ * a link and follow_symlinks
+ */
+ if ((flags & WALK_TREE_RECURSIVE) &&
+ (!(flags & WALK_TREE_SYMLINK) && S_ISDIR(st.st_mode)) ||
+ ((flags & WALK_TREE_SYMLINK) && follow_symlinks)) {
struct dirent *entry;
/*