[PATCH v2] btrfs-progs: filesystem: du: skip file that permission denied

Sidong Yang
2021-11-21T15:16:28Z

This patch handles issue #421. Filesystem du command fails and exit
when it access file that has permission denied. But it can continue the
command except the files. This patch recovers ret value when permission
denied.

Signed-off-by: Sidong Yang <realwakka@gmail.com>
---
cmds/filesystem-du.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmds/filesystem-du.c b/cmds/filesystem-du.c
index 5865335d..fb7753ca 100644
--- a/cmds/filesystem-du.c
+++ b/cmds/filesystem-du.c
@@ -403,7 +403,7 @@ static int du_walk_dir(struct du_dir_ctxt *ctxt, struct rb_root *shared_extents)
dirfd(dirstream),
shared_extents, &tot, &shr,
0);
- if (ret == -ENOTTY) {
+ if (ret == -ENOTTY || ret == -EACCES) {
ret = 0;
continue;
} else if (ret) {
--
2.25.1