lib9p

Go 9P library.
Log | Files | Refs

commit 78816749545a396144db5f5e36e214315aa3afc9
parent 6c0fb5f5168ff39c12df843993303b61c1b9ace1
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Fri, 15 Sep 2023 09:25:33 +0900

fix walk bug

Diffstat:
Mdiskfs/file.go | 4++--
Mfile.go | 3++-
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/diskfs/file.go b/diskfs/file.go @@ -49,6 +49,7 @@ func getChildEntry(fsys *FS, dir *os.File) ([]*lib9p.DirEntry, error) { } func openFile(fsys *FS, fpath string, mode lib9p.OpenMode) (*File, error) { + // TODO: check if path exists. /* fsfile, err := fsys.fs.Open(fpath) if err != nil { @@ -150,11 +151,10 @@ func (f *File) Child() ([]lib9p.File, error) { cpath := path.Join(f.path, childEntry[i].Name()) child, e := f.fs.Open(cpath) if e != nil { - files[i] = nil err = e continue } - files[i] = child + files = append(files, child) } return files, err } diff --git a/file.go b/file.go @@ -4,6 +4,7 @@ import "fmt" type File interface { Parent() (File, error) + Child() ([]File, error) // Children Stat() (*FileInfo, error) @@ -48,7 +49,7 @@ func walkfile(f File, name string) (File, error) { } s, err := child.Stat() if err != nil { - return nil, fmt.Errorf("stat: %v", err) + continue } if s.Name() == name { return child, nil