lib/fs: Avoid dirty offset read in fakefs (fixes #6584)

This commit is contained in:
Jakob Borg 2020-04-28 09:58:31 +02:00
parent 5e1cd0e71a
commit 0e2a07d71a

View File

@ -754,7 +754,10 @@ func (f *fakeFile) Seek(offset int64, whence int) (int64, error) {
}
func (f *fakeFile) Write(p []byte) (int, error) {
return f.WriteAt(p, f.offset)
f.mut.Lock()
offs := f.offset
f.mut.Unlock()
return f.WriteAt(p, offs)
}
func (f *fakeFile) WriteAt(p []byte, off int64) (int, error) {