1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:20:23 -07:00

os: return *PathError error in File.Sync on Plan 9

File.Sync was returning *SyscallError instead of *PathError on Plan 9.
Adjust the error type to match other systems.

Fixes #39800

Change-Id: I844e716eb61c193ef78d29cb0b4a3ef790bb3320
Reviewed-on: https://go-review.googlesource.com/c/go/+/239857
Reviewed-by: David du Colombier <0intro@gmail.com>
This commit is contained in:
Fazlul Shahriar 2020-06-25 01:15:42 -04:00 committed by David du Colombier
parent 1bb247a469
commit 334752dc82

View File

@ -233,10 +233,10 @@ func (f *File) Sync() error {
var buf [syscall.STATFIXLEN]byte
n, err := d.Marshal(buf[:])
if err != nil {
return NewSyscallError("fsync", err)
return &PathError{"sync", f.name, err}
}
if err = syscall.Fwstat(f.fd, buf[:n]); err != nil {
return NewSyscallError("fsync", err)
return &PathError{"sync", f.name, err}
}
return nil
}