From 4c1eae97cff2541514e5da8a6991accf1815b8cc Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Mon, 15 Mar 2021 15:48:37 +0100 Subject: [PATCH] vfs/cbe: fix result of SnapshotsFS.num_dirent("/") The snapshots file system used to return the number of snapshots on 'num_dirent' when called for the root directory although it was expected to return 1. This confused the tooling ontop of the VFS. Ref #4032 --- repos/gems/src/lib/vfs/cbe/vfs.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repos/gems/src/lib/vfs/cbe/vfs.cc b/repos/gems/src/lib/vfs/cbe/vfs.cc index 007c0b1520..c42c73ffc9 100644 --- a/repos/gems/src/lib/vfs/cbe/vfs.cc +++ b/repos/gems/src/lib/vfs/cbe/vfs.cc @@ -3007,7 +3007,10 @@ class Vfs_cbe::Snapshots_file_system : public Vfs::File_system file_size num_dirent(char const *path) override { - if (_top_dir(path) || _root_dir(path)) { + if (_top_dir(path)) { + return 1; + } + if (_root_dir(path)) { _snap_reg.update(_vfs_env); file_size const num = _snap_reg.number_of_snapshots(); return num;