From: Rob Date: Tue, 19 May 2020 20:21:52 +0000 (-0700) Subject: [utils] Fix file permissions in write_json_file (closes #12471) (#25122) X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=9cd5f54e31bcfde1f0491d2c7c3e2b467386f3d6;p=youtube-dl [utils] Fix file permissions in write_json_file (closes #12471) (#25122) --- 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: