mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-02-15 19:44:27 +01:00
Never ever try to close the same fd double times, even in a unit test.
A file descriptor is a number which will be reused, so when you close
the same number twice you may close another file descriptor in the second
time and then there will be an error 'Bad file descriptor (os error 9)'
while the wrongly closed fd is being used.
Fixes: #6679
Signed-off-by: Tim Zhang <tim@hyper.sh>
(cherry picked from commit 53c749a9de)