Skip to content

Commit

Permalink
[utils] Fix file permissions in write_json_file (closes #12471) (#25122)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankenyr authored and pareronia committed Jun 22, 2020
1 parent ea6fdfc commit f8a1973
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions youtube_dl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f8a1973

Please sign in to comment.