tcall fsync before rename - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 7b27f01e07b6792d448a9680f413d1677c40ce55
DIR parent 5c73bc5bc7b331b773d78761da505b20fd9db4c1
HTML Author: ThomasV <thomasv@gitorious>
Date: Tue, 19 May 2015 11:56:33 +0200
call fsync before rename
Diffstat:
M lib/wallet.py | 2 ++
1 file changed, 2 insertions(+), 0 deletions(-)
---
DIR diff --git a/lib/wallet.py b/lib/wallet.py
t@@ -119,6 +119,8 @@ class WalletStorage(object):
s = json.dumps(self.data, indent=4, sort_keys=True)
with open(temp_path, "w") as f:
f.write(s)
+ f.flush()
+ os.fsync(f.fileno())
# perform atomic write on POSIX systems
try:
os.rename(temp_path, self.path)