diff options
author | Rob <ankenyr@gmail.com> | 2020-05-19 13:21:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-20 03:21:52 +0700 |
commit | 9cd5f54e31bcfde1f0491d2c7c3e2b467386f3d6 (patch) | |
tree | d172aab2abd80510932b89df18c018b84070e0e0 | |
parent | 9a269547f2268822724018330c8a939d3bdc2db4 (diff) |
[utils] Fix file permissions in write_json_file (closes #12471) (#25122)
-rw-r--r-- | youtube_dl/utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 112279ed7..d1eca3760 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -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: |