mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Fix file descriptor leak in lineinfile module. (#57328)
This commit is contained in:
2
changelogs/fragments/57327-fix-file-descriptor-leak.yaml
Normal file
2
changelogs/fragments/57327-fix-file-descriptor-leak.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- lineinfile - fix a race / file descriptor leak when writing the file (https://github.com/ansible/ansible/issues/57327)
|
||||
@@ -215,7 +215,7 @@ from ansible.module_utils._text import to_bytes, to_native
|
||||
def write_changes(module, b_lines, dest):
|
||||
|
||||
tmpfd, tmpfile = tempfile.mkstemp()
|
||||
with open(tmpfile, 'wb') as f:
|
||||
with os.fdopen(tmpfd, 'wb') as f:
|
||||
f.writelines(b_lines)
|
||||
|
||||
validate = module.params.get('validate', None)
|
||||
|
||||
Reference in New Issue
Block a user