mirror of
https://github.com/datarhei/core.git
synced 2025-10-07 00:43:39 +08:00
Fix concurrent map read and map write
This commit is contained in:
@@ -355,7 +355,11 @@ func (fs *memFilesystem) Symlink(oldname, newname string) error {
|
|||||||
func (fs *memFilesystem) WriteFileReader(path string, r io.Reader) (int64, bool, error) {
|
func (fs *memFilesystem) WriteFileReader(path string, r io.Reader) (int64, bool, error) {
|
||||||
path = fs.cleanPath(path)
|
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")
|
return -1, false, fmt.Errorf("path not writeable")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user