func saveCsrfTokens() { // We're ignoring errors in here. It's not super critical and there's // nothing relevant we can do about them anyway... name := locations[locCsrfTokens] f, err := osutil.CreateAtomic(name, 0600) if err != nil { return } for _, t := range csrfTokens { fmt.Fprintln(f, t) } f.Close() }
// Save writes the configuration to disk, and generates a ConfigSaved event. func (w *Wrapper) Save() error { fd, err := osutil.CreateAtomic(w.path, 0600) if err != nil { return err } if err := w.cfg.WriteXML(fd); err != nil { fd.Close() return err } if err := fd.Close(); err != nil { return err } events.Default.Log(events.ConfigSaved, w.cfg) return nil }