Warn on Sync() failure instead of erroring.
This commit is contained in:
parent
c824f2dc74
commit
206d5526b0
1 changed files with 10 additions and 7 deletions
17
disksync.go
17
disksync.go
|
@ -394,18 +394,19 @@ func (a *Account) writeWallet(dir string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = a.Wallet.WriteTo(tmpfile); err != nil {
|
if _, err = a.Wallet.WriteTo(tmpfile); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmppath := tmpfile.Name()
|
||||||
if err := tmpfile.Sync(); err != nil {
|
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 {
|
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)
|
return Rename(tmppath, wfilepath)
|
||||||
|
@ -423,13 +424,15 @@ func (a *Account) writeTxStore(dir string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmppath := tmpfile.Name()
|
||||||
if err := tmpfile.Sync(); err != nil {
|
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 {
|
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)
|
return Rename(tmppath, txfilepath)
|
||||||
|
|
Loading…
Reference in a new issue