Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove possible file descriptor leak if safe_close_and_exec fails #5596

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

freddy77
Copy link
Collaborator

Make sure we release the sock file descriptors in all cases.
Add test trying to reproduce the issue passing an invalid file descriptor; not a perfect reproduction but failure in this function can happen for instance if daemon is restarted.

ocaml/forkexecd/test/fe_test.ml Outdated Show resolved Hide resolved
ocaml/forkexecd/test/fe_test.ml Outdated Show resolved Hide resolved
ocaml/forkexecd/test/fe_test.ml Outdated Show resolved Hide resolved
fail is always used in combination with Printf.sprintf so combine the two.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
More compact code.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
"exe" variable is compute in mutiple functions, not very expensive to
compute once.
Reduce code.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
Make sure we release the "sock" file descriptors in all cases.
Add test trying to reproduce the issue passing an invalid file descriptor; not
a perfect reproduction but failure in this function can happen for instance if
daemon is restarted.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
We just want information about the current process.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
@freddy77
Copy link
Collaborator Author

ping

ocaml/forkexecd/test/fe_test.ml Outdated Show resolved Hide resolved
In case of getting the list of files we called Unix.readlink twice for every file
descriptor.
In case we wanted just the count we computed the list anyway.
Factor out code to avoid calling function twice and do not compute the list
is not needed.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants