Adding additional permissions and respecting umask
This commit is contained in:
parent
177a9ad6cc
commit
bf4361ae92
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user