mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
lib/config: Handle empty Fstype for mtime-window (#5906)
This commit is contained in:
parent
7d5f7d508d
commit
d681ac11fe
@ -248,18 +248,12 @@ func (f *FolderConfiguration) prepare() {
|
||||
case f.RawModTimeWindowS > 0:
|
||||
f.cachedModTimeWindow = time.Duration(f.RawModTimeWindowS) * time.Second
|
||||
case runtime.GOOS == "android":
|
||||
usage, err := disk.Usage(f.Filesystem().URI())
|
||||
if err != nil {
|
||||
l.Debugf("Error detecting FS at %v on android, setting mtime window to 2s: %v", f.Path, err)
|
||||
if usage, err := disk.Usage(f.Filesystem().URI()); err != nil || usage.Fstype == "" || strings.Contains(strings.ToLower(usage.Fstype), "fat") {
|
||||
f.cachedModTimeWindow = 2 * time.Second
|
||||
break
|
||||
l.Debugf(`Detecting FS at %v on android: Setting mtime window to 2s: err == %v, usage.Fstype == "%v"`, f.Path, err, usage.Fstype)
|
||||
} else {
|
||||
l.Debugf(`Detecting FS at %v on android: Leaving mtime window at 0: usage.Fstype == "%v"`, f.Path, usage.Fstype)
|
||||
}
|
||||
if strings.Contains(strings.ToLower(usage.Fstype), "fat") {
|
||||
l.Debugf("Detecting FS at %v on android, found %v, thus setting mtime window to 2s", f.Path, usage.Fstype)
|
||||
f.cachedModTimeWindow = 2 * time.Second
|
||||
break
|
||||
}
|
||||
l.Debugf("Detecting FS at %v on android, found %v, thus leaving mtime window at 0", f.Path, usage.Fstype)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user