From 7b27f01e07b6792d448a9680f413d1677c40ce55 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Tue, 19 May 2015 11:56:33 +0200 Subject: [PATCH] call fsync before rename --- lib/wallet.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/wallet.py b/lib/wallet.py index 39523bbf..9a7e974a 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -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)