mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
cmd/syncthing, lib/config: Log errors replacing or saving config (ref #3567)
This commit is contained in:
parent
3cabecda04
commit
467c1b26fb
@ -765,11 +765,13 @@ func (s *apiService) postSystemConfig(w http.ResponseWriter, r *http.Request) {
|
|||||||
// Activate and save
|
// Activate and save
|
||||||
|
|
||||||
if err := s.cfg.Replace(to); err != nil {
|
if err := s.cfg.Replace(to); err != nil {
|
||||||
|
l.Warnln("Replacing config:", err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.cfg.Save(); err != nil {
|
if err := s.cfg.Save(); err != nil {
|
||||||
|
l.Warnln("Saving config:", err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -304,15 +304,18 @@ func (w *Wrapper) Device(id protocol.DeviceID) (DeviceConfiguration, bool) {
|
|||||||
func (w *Wrapper) Save() error {
|
func (w *Wrapper) Save() error {
|
||||||
fd, err := osutil.CreateAtomic(w.path, 0600)
|
fd, err := osutil.CreateAtomic(w.path, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
l.Debugln("CreateAtomic:", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := w.cfg.WriteXML(fd); err != nil {
|
if err := w.cfg.WriteXML(fd); err != nil {
|
||||||
|
l.Debugln("WriteXML:", err)
|
||||||
fd.Close()
|
fd.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := fd.Close(); err != nil {
|
if err := fd.Close(); err != nil {
|
||||||
|
l.Debugln("Close:", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user