Skip to content

Commit

Permalink
Warn on Sync() failure instead of erroring.
Browse files Browse the repository at this point in the history
  • Loading branch information
dajohi committed Jun 25, 2014
1 parent c824f2d commit 206d552
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions disksync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 206d552

Please sign in to comment.