diff options
author | Mattias Nissler <122288598+mnissler-rivos@users.noreply.github.com> | 2023-08-15 13:38:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-15 12:38:30 +0100 |
commit | e8c37f83fb92848f328e297ace37536253ee08bc (patch) | |
tree | ff61bba39e20b62240e46b95504d2f1f6f4671c1 /lib/pci.c | |
parent | 1cca91aeb8ae8f531f9c3b9c59d83630e9941a5e (diff) | |
download | libvfio-user-e8c37f83fb92848f328e297ace37536253ee08bc.zip libvfio-user-e8c37f83fb92848f328e297ace37536253ee08bc.tar.gz libvfio-user-e8c37f83fb92848f328e297ace37536253ee08bc.tar.bz2 |
Introduce close_safely helper function (#763)
The helper function centralizes some extra checks and diligence desired
by many/most current code paths but currently inconsistently applied.
This includes bypassing the close call when the file descriptor is -1
already, resetting the file descriptor variable to -1 after closing, and
preserving errno.
All calls to close are replaced by close_safely. Some warning log output
is lost over this, but it doesn't seem like this was very useful anyways
given that Linux always closes the file descriptor anyways.
Signed-off-by: Mattias Nissler <mnissler@rivosinc.com>
Diffstat (limited to 'lib/pci.c')
0 files changed, 0 insertions, 0 deletions