commit 3d15558b381b83dad24ec184e1d98467d2fe4632
parent bf5fb5e53c5b29bf9a93cdce0b005fd16916683a
Author: Matsuda Kenji <info@mtkn.jp>
Date: Wed, 29 Nov 2023 08:37:21 +0900
fix bug where r.Ofcall for rWalk can be nil
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/server.go b/server.go
@@ -379,6 +379,12 @@ func sWalk(ctx context.Context, s *Server, r *Req) {
func rWalk(r *Req, err error) {
ifcall := r.Ifcall.(*TWalk)
+ if r.Ofcall == nil {
+ if err == nil {
+ panic("err and r.Ofcall are both nil")
+ }
+ setError(r, err)
+ }
ofcall := r.Ofcall.(*RWalk)
if err != nil || len(ofcall.Qids) < len(ifcall.Wnames) {
if ifcall.Fid != ifcall.Newfid {
@@ -825,7 +831,8 @@ func sWStat(ctx context.Context, s *Server, r *Req) {
Respond(ctx, r, fmt.Errorf("operation not permitted"))
return
}
- if wstat.Name != "" {
+ if wstat.Name != "" && newStat.Name != wstat.Name {
+ log.Printf("wstat: %q, %q", newStat.Name, wstat.Name)
parentPath := path.Dir(r.Fid.path)
parent, err := s.fs.OpenFile(parentPath, OREAD)
if err != nil {