lib/fs: Add missing locks to fakeFile methods (fixes #9499) (#9603)

fixes #9499
This commit is contained in:
Simon Frei 2024-07-09 10:33:30 +02:00 committed by GitHub
parent 0756e42a85
commit 0fe6d97d3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -924,6 +924,8 @@ func (f *fakeFile) Name() string {
if f.presentedName != "" {
return f.presentedName
}
f.mut.Lock()
defer f.mut.Unlock()
return f.name
}
@ -949,7 +951,9 @@ func (f *fakeFile) Truncate(size int64) error {
}
func (f *fakeFile) Stat() (FileInfo, error) {
f.mut.Lock()
info := &fakeFileInfo{*f.fakeEntry}
f.mut.Unlock()
if f.presentedName != "" {
info.name = f.presentedName
}