mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 12:30:07 +00:00
storage: try to handle user deleting/renaming wallet file while running
related: #4110, #6358
This commit is contained in:
parent
6443bb7d8d
commit
05ebd0f5b2
1 changed files with 7 additions and 1 deletions
|
@ -87,7 +87,13 @@ class WalletStorage(Logger):
|
|||
f.flush()
|
||||
os.fsync(f.fileno())
|
||||
|
||||
mode = os.stat(self.path).st_mode if self.file_exists() else stat.S_IREAD | stat.S_IWRITE
|
||||
default_mode = stat.S_IREAD | stat.S_IWRITE
|
||||
try:
|
||||
mode = os.stat(self.path).st_mode if self.file_exists() else default_mode
|
||||
except FileNotFoundError:
|
||||
# user might have deleted/renamed file while running
|
||||
mode = default_mode
|
||||
|
||||
# assert that wallet file does not exist, to prevent wallet corruption (see issue #5082)
|
||||
if not self.file_exists():
|
||||
assert not os.path.exists(self.path)
|
||||
|
|
Loading…
Add table
Reference in a new issue