]> ruderich.org/simon Gitweb - nsscash/nsscash.git/blobdiff - state.go
Guarantee durability after renaming temporary files
[nsscash/nsscash.git] / state.go
index be08e7279ab0641f9fe43c940ee498003107014a..59c885ae9cf17c9a15a2e980702926a24cf26339 100644 (file)
--- a/state.go
+++ b/state.go
@@ -80,5 +80,9 @@ func WriteState(path string, state *State) error {
        if err != nil {
                return err
        }
-       return f.CloseAtomicallyReplace()
+       err = f.CloseAtomicallyReplace()
+       if err != nil {
+               return err
+       }
+       return syncPath(filepath.Dir(path))
 }