cmd/syncthing: Don't rewrite config on startup unless necessary (#5399)
This commit is contained in:
parent
99c9d65ddf
commit
c8123bda28
@ -840,13 +840,16 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
|
|||||||
|
|
||||||
if opts := cfg.Options(); IsCandidate {
|
if opts := cfg.Options(); IsCandidate {
|
||||||
l.Infoln("Anonymous usage reporting is always enabled for candidate releases.")
|
l.Infoln("Anonymous usage reporting is always enabled for candidate releases.")
|
||||||
opts.URAccepted = usageReportVersion
|
if opts.URAccepted != usageReportVersion {
|
||||||
cfg.SetOptions(opts)
|
opts.URAccepted = usageReportVersion
|
||||||
cfg.Save()
|
cfg.SetOptions(opts)
|
||||||
// Unique ID will be set and config saved below if necessary.
|
cfg.Save()
|
||||||
|
// Unique ID will be set and config saved below if necessary.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts := cfg.Options(); opts.URUniqueID == "" {
|
// If we are going to do usage reporting, ensure we have a valid unique ID.
|
||||||
|
if opts := cfg.Options(); opts.URAccepted > 0 && opts.URUniqueID == "" {
|
||||||
opts.URUniqueID = rand.String(8)
|
opts.URUniqueID = rand.String(8)
|
||||||
cfg.SetOptions(opts)
|
cfg.SetOptions(opts)
|
||||||
cfg.Save()
|
cfg.Save()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user