mirror of
https://github.com/kdave/btrfs-progs
synced 2025-05-04 00:47:56 +00:00
btrfs-progs: fi du: skip inaccessible files
Filesystem du command fails and exits when it access file that has permission denied. But it can continue the command except the files. This patch prints error message just like /bin/du does and it continues if it can. Issue: #421 Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Sidong Yang <realwakka@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
9756d90ce3
commit
bc2382eff9
@ -403,14 +403,14 @@ 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) {
|
||||
ret = 0;
|
||||
continue;
|
||||
} else if (ret) {
|
||||
if (ret) {
|
||||
errno = -ret;
|
||||
fprintf(stderr,
|
||||
"failed to walk dir/file: %s : %m\n",
|
||||
entry->d_name);
|
||||
fprintf(stderr, "cannot access: '%s:' %m\n",
|
||||
entry->d_name);
|
||||
if (ret == -ENOTTY || ret == -EACCES) {
|
||||
ret = 0;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user