From 206d5526b02970c83cab57c58a2f8ebd88ae7862 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 25 Jun 2014 14:52:55 -0400 Subject: [PATCH] Warn on Sync() failure instead of erroring. --- disksync.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/disksync.go b/disksync.go index de58815..28d3818 100644 --- a/disksync.go +++ b/disksync.go @@ -394,18 +394,19 @@ func (a *Account) writeWallet(dir string) error { if err != nil { return err } - if _, err = a.Wallet.WriteTo(tmpfile); err != nil { return err } + tmppath := tmpfile.Name() if err := tmpfile.Sync(); err != nil { - return err + log.Warnf("Failed to sync temporary wallet file %s: %v", + tmppath, err) } - tmppath := tmpfile.Name() if err := tmpfile.Close(); err != nil { - log.Warnf("Cannot close temporary wallet file: %v", err) + log.Warnf("Cannot close temporary wallet file %s: %v", + tmppath, err) } return Rename(tmppath, wfilepath) @@ -423,13 +424,15 @@ func (a *Account) writeTxStore(dir string) error { return err } + tmppath := tmpfile.Name() if err := tmpfile.Sync(); err != nil { - return err + log.Warnf("Failed to sync temporary txstore file %s: %v", + tmppath, err) } - tmppath := tmpfile.Name() if err := tmpfile.Close(); err != nil { - log.Warnf("Cannot close temporary txstore file: %v", err) + log.Warnf("Cannot close temporary txstore file %s: %v", + tmppath, err) } return Rename(tmppath, txfilepath)