commit: 9cd5f54e31bcfde1f0491d2c7c3e2b467386f3d6
parent 9a269547f2268822724018330c8a939d3bdc2db4
Author: Rob <ankenyr@gmail.com>
Date: Tue, 19 May 2020 13:21:52 -0700
[utils] Fix file permissions in write_json_file (closes #12471) (#25122)
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git 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: