syncthing/syncthing — pull request #840 by mvdan (2014-10-13 13:21:11+00:00)
Title: Better handling of wrong config files

I was editing my config externally and restarted syncthing for it to pick up the config changes. But all it did was report that no config file was found and stomp my modified config with the default one.

The issue was that config.Load() had failed, but not because the file didn't exist, but because the XML was wrong - I had left a boolean field empty.

Anyway, I made it check that the file exists and that it actually is a file before trying Load(). And if Load() fails, I personally think it would be best to not replace a config on disk with the default config, since important data might be lost.

Cheers!