lib9p

Go 9P library.
Log | Files | Refs | LICENSE

commit a4393eee59500105689e3e355db32e6a46951d07
parent 49d578b3bf0353f3a4138063fe7834d8a662fd57
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Tue,  9 Jan 2024 12:53:30 +0900

modify diskfs.File.ReadDir's error handling

Diffstat:
Mdiskfs/file.go | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/diskfs/file.go b/diskfs/file.go @@ -70,11 +70,10 @@ func (f *File) ReadAt(p []byte, off int64) (int, error) { // to the end of the directory), it returns the slice and a nil error. // If it encounters an error before the end of the directory, // ReadDir returns the DirEntry list read until that point and a non-nil error. +// +// TODO: handle errors correctly. func (f *File) ReadDir(n int) ([]fs.DirEntry, error) { osde, err := f.file.ReadDir(n) - if err != nil { - return nil, fmt.Errorf("readdir: %v", err) - } de := make([]fs.DirEntry, len(osde)) for i, e := range osde { fi, err := e.Info() @@ -87,9 +86,8 @@ func (f *File) ReadDir(n int) ([]fs.DirEntry, error) { return nil, fmt.Errorf("fiStat: %v", err) } de[i] = &lib9p.DirEntry{Stat: *stat} - } - return de, nil + return de, err } func (f *File) WriteAt(p []byte, off int64) (int, error) {