Fix concurrent map read and map write

This commit is contained in:
Ingo Oppermann 2023-03-24 09:13:12 +01:00
parent d8c5b27d89
commit 83f94e1ef5
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E

View File

@ -355,7 +355,11 @@ func (fs *memFilesystem) Symlink(oldname, newname string) error {
func (fs *memFilesystem) WriteFileReader(path string, r io.Reader) (int64, bool, error) {
path = fs.cleanPath(path)
if fs.isDir(path) {
fs.filesLock.Lock()
isdir := fs.isDir(path)
fs.filesLock.Unlock()
if isdir {
return -1, false, fmt.Errorf("path not writeable")
}