From 1fabbe8a25f8cd4183589f728dcf9a5031905b2d Mon Sep 17 00:00:00 2001 From: Robert Coelho Date: Tue, 24 May 2022 12:48:32 -0400 Subject: [PATCH] mount: cleanup ReadDir rewrite's branches to not assume offsets --- weed/mount/weedfs_dir_read.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weed/mount/weedfs_dir_read.go b/weed/mount/weedfs_dir_read.go index 6250283ca..6e65bec13 100644 --- a/weed/mount/weedfs_dir_read.go +++ b/weed/mount/weedfs_dir_read.go @@ -141,7 +141,7 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl dh := wfs.GetDirectoryHandle(DirectoryHandleId(input.Fh)) if input.Offset == 0 { dh.reset() - } else if dh.isFinished && input.Offset >= directoryStreamBaseOffset { + } else if dh.isFinished && input.Offset >= dh.entryStreamOffset { entryCurrentIndex := input.Offset - dh.entryStreamOffset if uint64(len(dh.entryStream)) <= entryCurrentIndex { return fuse.OK @@ -196,8 +196,8 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl } var lastEntryName string - if input.Offset >= directoryStreamBaseOffset { - if input.Offset > directoryStreamBaseOffset { + if input.Offset >= dh.entryStreamOffset { + if input.Offset > dh.entryStreamOffset { entryPreviousIndex := (input.Offset - dh.entryStreamOffset) - 1 if uint64(len(dh.entryStream)) > entryPreviousIndex { lastEntryName = dh.entryStream[entryPreviousIndex].Name()