afero icon indicating copy to clipboard operation
afero copied to clipboard

Directory buffering in MemMapFs.Readdir

Open std0 opened this issue 4 years ago • 0 comments

os.File.Readdir under the hood uses buffering of directory contents, which gives it ability to traverse directory and remove files at the same time. Currently, MemMapFs.Readdir retrieves files from f.fileData.memDir.Files() on each call, which means that if one tries to remove a file between Readdir calls, f.readDirCount won't be relevant and in some cases slice bounds might be violated.

std0 avatar Aug 20 '20 00:08 std0