electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit cb09d88322b58db20b576f35a0319131efc20162
parent e5cc79e65ecb77fd8a8d09a7d1b6b61699f43e20
Author: ThomasV <thomasv@gitorious>
Date:   Fri, 24 Apr 2015 21:01:34 +0200

fix bug introduced in 21673c95f4b9546e115fa8a128b0c6bb8c74d4b0

Diffstat:
Mlib/wallet.py | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/wallet.py b/lib/wallet.py @@ -139,8 +139,12 @@ class WalletStorage(object): s = json.dumps(self.data, indent=4, sort_keys=True) with open(temp_path, "w") as f: f.write(s) - os.remove(self.path) - os.rename(temp_path, self.path) + # perform atomic write on POSIX systems + try: + os.rename(temp_path, self.path) + except: + os.remove(self.path) + os.rename(temp_path, self.path) if 'ANDROID_DATA' not in os.environ: import stat os.chmod(self.path,stat.S_IREAD | stat.S_IWRITE)