mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
Ignore error on os.Chtimes in config archiving
This commit is contained in:
parent
f36f48c2cf
commit
2fae7ccf5c
@ -936,15 +936,11 @@ func loadOrCreateConfig() *config.Wrapper {
|
|||||||
func archiveAndSaveConfig(cfg *config.Wrapper) error {
|
func archiveAndSaveConfig(cfg *config.Wrapper) error {
|
||||||
// To prevent previous config from being cleaned up, quickly touch it too
|
// To prevent previous config from being cleaned up, quickly touch it too
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
err := os.Chtimes(cfg.ConfigPath(), now, now)
|
_ = os.Chtimes(cfg.ConfigPath(), now, now) // May return error on Android etc; no worries
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
archivePath := cfg.ConfigPath() + fmt.Sprintf(".v%d", cfg.Raw().OriginalVersion)
|
archivePath := cfg.ConfigPath() + fmt.Sprintf(".v%d", cfg.Raw().OriginalVersion)
|
||||||
l.Infoln("Archiving a copy of old config file format at:", archivePath)
|
l.Infoln("Archiving a copy of old config file format at:", archivePath)
|
||||||
err = osutil.Rename(cfg.ConfigPath(), archivePath)
|
if err := osutil.Rename(cfg.ConfigPath(), archivePath); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user