0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-12-29 01:51:06 +00:00

[utils] Fix file permissions in write_json_file (closes #12471) (#25122)

This commit is contained in:
Rob 2020-05-19 13:21:52 -07:00 committed by GitHub
parent 9a269547f2
commit 9cd5f54e31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1837,6 +1837,12 @@ def write_json_file(obj, fn):
os.unlink(fn)
except OSError:
pass
try:
mask = os.umask(0)
os.umask(mask)
os.chmod(tf.name, 0o666 & ~mask)
except OSError:
pass
os.rename(tf.name, fn)
except Exception:
try: