mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
searx: Set file permissions while creating file
To avoid race conditions. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
7e60db76c4
commit
0e9d10bff5
@ -152,6 +152,9 @@ def gunzip(gzip_file, output_file):
|
||||
|
||||
with gzip.open(gzip_file, 'rb') as file_handle:
|
||||
contents = file_handle.read()
|
||||
with open(output_file, 'wb') as file_handle:
|
||||
|
||||
def opener(path, flags):
|
||||
return os.open(path, flags, mode=0o644)
|
||||
|
||||
with open(output_file, 'wb', opener=opener) as file_handle:
|
||||
file_handle.write(contents)
|
||||
os.chmod(output_file, 0o644)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user