From 467c1b26fb757eb647682b6a813fe153a45bd5ad Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sat, 24 Sep 2016 09:58:17 +0200 Subject: [PATCH] cmd/syncthing, lib/config: Log errors replacing or saving config (ref #3567) --- cmd/syncthing/gui.go | 2 ++ lib/config/wrapper.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index d884bd516..6fe6398d2 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -765,11 +765,13 @@ func (s *apiService) postSystemConfig(w http.ResponseWriter, r *http.Request) { // Activate and save if err := s.cfg.Replace(to); err != nil { + l.Warnln("Replacing config:", err) http.Error(w, err.Error(), http.StatusInternalServerError) return } if err := s.cfg.Save(); err != nil { + l.Warnln("Saving config:", err) http.Error(w, err.Error(), http.StatusInternalServerError) return } diff --git a/lib/config/wrapper.go b/lib/config/wrapper.go index 4b62280ab..dcce23ec3 100644 --- a/lib/config/wrapper.go +++ b/lib/config/wrapper.go @@ -304,15 +304,18 @@ func (w *Wrapper) Device(id protocol.DeviceID) (DeviceConfiguration, bool) { func (w *Wrapper) Save() error { fd, err := osutil.CreateAtomic(w.path, 0600) if err != nil { + l.Debugln("CreateAtomic:", err) return err } if err := w.cfg.WriteXML(fd); err != nil { + l.Debugln("WriteXML:", err) fd.Close() return err } if err := fd.Close(); err != nil { + l.Debugln("Close:", err) return err }