mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-24 23:48:26 +00:00
Data race: broken locking on model.folderIgnores
This commit is contained in:
parent
a918aa97d9
commit
7f829f0159
@ -779,10 +779,12 @@ func (m *Model) GetIgnores(folder string) ([]string, []string, error) {
|
|||||||
lines = append(lines, strings.TrimSpace(scanner.Text()))
|
lines = append(lines, strings.TrimSpace(scanner.Text()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.fmut.RLock()
|
||||||
var patterns []string
|
var patterns []string
|
||||||
if matcher := m.folderIgnores[folder]; matcher != nil {
|
if matcher := m.folderIgnores[folder]; matcher != nil {
|
||||||
patterns = matcher.Patterns()
|
patterns = matcher.Patterns()
|
||||||
}
|
}
|
||||||
|
m.fmut.RUnlock()
|
||||||
|
|
||||||
return lines, patterns, nil
|
return lines, patterns, nil
|
||||||
}
|
}
|
||||||
@ -1050,7 +1052,7 @@ func (m *Model) ScanFolderSub(folder, sub string) error {
|
|||||||
return errors.New("invalid subpath")
|
return errors.New("invalid subpath")
|
||||||
}
|
}
|
||||||
|
|
||||||
m.fmut.RLock()
|
m.fmut.Lock()
|
||||||
fs, ok := m.folderFiles[folder]
|
fs, ok := m.folderFiles[folder]
|
||||||
dir := m.folderCfgs[folder].Path
|
dir := m.folderCfgs[folder].Path
|
||||||
|
|
||||||
@ -1066,7 +1068,8 @@ func (m *Model) ScanFolderSub(folder, sub string) error {
|
|||||||
CurrentFiler: cFiler{m, folder},
|
CurrentFiler: cFiler{m, folder},
|
||||||
IgnorePerms: m.folderCfgs[folder].IgnorePerms,
|
IgnorePerms: m.folderCfgs[folder].IgnorePerms,
|
||||||
}
|
}
|
||||||
m.fmut.RUnlock()
|
m.fmut.Unlock()
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("no such folder")
|
return errors.New("no such folder")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user