diff options
author | Pavel Polacek <xpolish@gmail.com> | 2020-10-31 00:14:00 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2020-11-14 20:45:37 +0100 |
commit | a966a2b55bb13e22d9b1e6da8182655948d209ae (patch) | |
tree | 932893cdf22457d3c6f69f7dfafe78e3feedefcb /libmisc | |
parent | 33564fd260d5b1c01dff3d2a26cba09c714eb4f7 (diff) | |
download | acl-a966a2b55bb13e22d9b1e6da8182655948d209ae.tar.gz |
getfacl: Add --one-file-system optionnext
Add a --one-filesystem option to getfacl. With this option, getfacl will not
cross mount points, similar to "tar --one-file-system".
(Patch modified by Andreas Gruenbacher.)
Diffstat (limited to 'libmisc')
-rw-r--r-- | libmisc/walk_tree.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libmisc/walk_tree.c b/libmisc/walk_tree.c index e712dcb..97e574c 100644 --- a/libmisc/walk_tree.c +++ b/libmisc/walk_tree.c @@ -48,6 +48,7 @@ struct walk_tree_args { struct entry_handle *closed; unsigned int num_dir_handles; struct stat st; + dev_t dev; }; static int walk_tree_visited(struct entry_handle *dirs, dev_t dev, ino_t ino) @@ -80,6 +81,14 @@ static int walk_tree_rec(struct walk_tree_args *args) if (lstat(args->path, &args->st) != 0) return args->func(args->path, NULL, flags | WALK_TREE_FAILED, args->arg); + + if (flags & WALK_TREE_ONE_FILESYSTEM) { + if (args->dev == 0) + args->dev = args->st.st_dev; + else if (args->st.st_dev != args->dev) + return 0; + } + if (S_ISLNK(args->st.st_mode)) { flags |= WALK_TREE_SYMLINK; if ((flags & WALK_TREE_DEREFERENCE) || @@ -243,6 +252,7 @@ int walk_tree(const char *path, int walk_flags, unsigned int num, args.func = func; args.arg = arg; args.depth = 0; + args.dev = 0; return walk_tree_rec(&args); } |