aboutsummaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorRob <[email protected]>2020-05-19 13:21:52 -0700
committerGitHub <[email protected]>2020-05-20 03:21:52 +0700
commit9cd5f54e31bcfde1f0491d2c7c3e2b467386f3d6 (patch)
treed172aab2abd80510932b89df18c018b84070e0e0 /youtube_dl/utils.py
parent9a269547f2268822724018330c8a939d3bdc2db4 (diff)
downloadyoutube-dl-9cd5f54e31bcfde1f0491d2c7c3e2b467386f3d6.tar.gz
youtube-dl-9cd5f54e31bcfde1f0491d2c7c3e2b467386f3d6.zip
[utils] Fix file permissions in write_json_file (closes #12471) (#25122)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py6
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: