Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
3f90020d
Commit
3f90020d
authored
Feb 10, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Open LOG_LOCK file with FD_CLOEXEC to prevent file descriptor leakage
Fixes #5399
parent
bbda98a3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
lib/ansible/callbacks.py
+10
-3
No files found.
lib/ansible/callbacks.py
View file @
3f90020d
...
...
@@ -74,12 +74,19 @@ def get_cowsay_info():
cowsay
,
noncow
=
get_cowsay_info
()
def
log_lockfile
():
# create the path for the lockfile and open it
tempdir
=
tempfile
.
gettempdir
()
uid
=
os
.
getuid
()
path
=
os
.
path
.
join
(
tempdir
,
".ansible-lock.
%
s"
%
uid
)
return
path
LOG_LOCK
=
open
(
log_lockfile
(),
'w'
)
lockfile
=
open
(
path
,
'w'
)
# use fcntl to set FD_CLOEXEC on the file descriptor,
# so that we don't leak the file descriptor later
lockfile_fd
=
lockfile
.
fileno
()
old_flags
=
fcntl
.
fcntl
(
lockfile_fd
,
fcntl
.
F_GETFD
)
fcntl
.
fcntl
(
lockfile_fd
,
fcntl
.
F_SETFD
,
old_flags
|
fcntl
.
FD_CLOEXEC
)
return
lockfile
LOG_LOCK
=
log_lockfile
()
def
log_flock
(
runner
):
if
runner
is
not
None
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment