Adding additional permissions and respecting umask

This commit is contained in:
Rob 2020-05-04 12:11:35 -07:00
parent 177a9ad6cc
commit bf4361ae92

View File

@ -1836,11 +1836,16 @@ def write_json_file(obj, fn):
os.unlink(fn) os.unlink(fn)
except OSError: except OSError:
pass pass
mask = os.umask(0)
os.umask(mask)
os.chmod(tf.name, os.chmod(tf.name,
stat.S_IRUSR | (stat.S_IRUSR
stat.S_IWUSR | | stat.S_IWUSR
stat.S_IRGRP | | stat.S_IRGRP
stat.S_IROTH) | stat.S_IWGRP
| stat.S_IROTH
| stat.S_IWOTH)
& ~mask)
os.rename(tf.name, fn) os.rename(tf.name, fn)
except Exception: except Exception: