Sync temporary files before closing and renaming.

This commit is contained in:
Josh Rickmar 2014-06-25 09:47:03 -05:00
parent cb6969843b
commit 72c7d05159

View file

@ -399,6 +399,10 @@ func (a *Account) writeWallet(dir string) error {
return err return err
} }
if err := tmpfile.Sync(); err != nil {
return err
}
tmppath := tmpfile.Name() tmppath := tmpfile.Name()
if err := tmpfile.Close(); err != nil { if err := tmpfile.Close(); err != nil {
log.Warnf("Cannot close temporary wallet file: %v", err) log.Warnf("Cannot close temporary wallet file: %v", err)
@ -419,6 +423,10 @@ func (a *Account) writeTxStore(dir string) error {
return err return err
} }
if err := tmpfile.Sync(); err != nil {
return err
}
tmppath := tmpfile.Name() tmppath := tmpfile.Name()
if err := tmpfile.Close(); err != nil { if err := tmpfile.Close(); err != nil {
log.Warnf("Cannot close temporary txstore file: %v", err) log.Warnf("Cannot close temporary txstore file: %v", err)