atomic write wallet file
This commit is contained in:
@@ -136,8 +136,9 @@ class WalletStorage(object):
|
||||
def write(self):
|
||||
assert not threading.currentThread().isDaemon()
|
||||
s = json.dumps(self.data, indent=4, sort_keys=True)
|
||||
with open(self.path,"w") as f:
|
||||
with open(self.path + '.tmp', "w") as f:
|
||||
f.write(s)
|
||||
os.rename(self.path + '.tmp', self.path)
|
||||
if 'ANDROID_DATA' not in os.environ:
|
||||
import stat
|
||||
os.chmod(self.path,stat.S_IREAD | stat.S_IWRITE)
|
||||
|
||||
Reference in New Issue
Block a user