mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-02 10:15:50 +00:00
Fix racecondition in status creation
This commit is contained in:
parent
e40ba55bd3
commit
eb5587f4ca
1 changed files with 6 additions and 1 deletions
|
|
@ -7,6 +7,7 @@
|
|||
:license: MIT, see LICENSE for more details.
|
||||
'''
|
||||
|
||||
import errno
|
||||
import functools
|
||||
import json
|
||||
import os
|
||||
|
|
@ -133,8 +134,12 @@ def save_status(path, status_name, status):
|
|||
'automatically, but this choice is left to the '
|
||||
'user. If you think this is an error, please file '
|
||||
'a bug at {}'.format(base_path, PROJECT_HOME))
|
||||
if not os.path.exists(base_path):
|
||||
|
||||
try:
|
||||
os.makedirs(base_path, 0o750)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
with safe_write(full_path, 'w+') as f:
|
||||
for k, v in status.items():
|
||||
|
|
|
|||
Loading…
Reference in a new issue