From 72c7d0515950d57b349a02fc7ae2f13a0405c67c Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 25 Jun 2014 09:47:03 -0500 Subject: [PATCH] Sync temporary files before closing and renaming. --- disksync.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/disksync.go b/disksync.go index 1779c96..de58815 100644 --- a/disksync.go +++ b/disksync.go @@ -399,6 +399,10 @@ func (a *Account) writeWallet(dir string) error { return err } + if err := tmpfile.Sync(); err != nil { + return err + } + tmppath := tmpfile.Name() if err := tmpfile.Close(); err != nil { log.Warnf("Cannot close temporary wallet file: %v", err) @@ -419,6 +423,10 @@ func (a *Account) writeTxStore(dir string) error { return err } + if err := tmpfile.Sync(); err != nil { + return err + } + tmppath := tmpfile.Name() if err := tmpfile.Close(); err != nil { log.Warnf("Cannot close temporary txstore file: %v", err)