diff options
author | Tim Shimmin <tes@sgi.com> | 2008-09-10 16:19:42 +0000 |
---|---|---|
committer | Tim Shimmin <tes@sgi.com> | 2008-09-10 16:19:42 +0000 |
commit | c9a5cfd7eb10d90d79725f1edd00374f3c4a475a (patch) | |
tree | 458ded5691d9e24ab90ee02f62ccc63df51f59e2 | |
parent | 4a9f940601928357b1bba6f4a726c537fa9b46b4 (diff) | |
download | attr-c9a5cfd7eb10d90d79725f1edd00374f3c4a475a.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/CHANGES | 5 | ||||
-rw-r--r-- | libmisc/walk_tree.c | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/doc/CHANGES b/doc/CHANGES index 5184a57..3780f08 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,8 @@ +attr-2.4.44 + - 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 + attr-2.4.43 (20 June 2008) - Added configurable attr exception list for xattr copy, thanks to Andreas Gruenbacher. 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; /* |