commit bd05b065a0165778d8b25f906af6e8f0e6a3e30e
parent 66deafdfb4f8b18f23c7296c3203440ba6ecca20
Author: Matsuda Kenji <info@mtkn.jp>
Date: Tue, 9 Jan 2024 15:43:39 +0900
delete fs.Glob from wstat
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/server.go b/server.go
@@ -1111,13 +1111,17 @@ func sWStat(ctx context.Context, c *conn, rc <-chan *request) {
// an existing file.
// but 9pfs, 9pfuse does the rename when used with `git init`.
/*
- children, err := fs.Glob(ExportFS{r.fid.fs}, path.Join(parentPath, "*"))
+ de, err := fs.ReadDir(ExportFS{FS: r.fid.fs}, parentPath)
if err != nil {
- r.err = fmt.Errorf("glob children: %v", err)
+ r.err = fmt.Errorf("readdir: %v", err)
goto resp
}
- for _, f := range children {
- if path.Base(f) == wstat.Name {
+ for _, e := range de {
+ fi, err := e.Info()
+ if err != nil {
+ r.err = fmt.Errorf("stat: %v", err)
+ }
+ if fi.Name() == wstat.Name {
r.err = fmt.Errorf("file already exists")
goto resp
}