mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 08:17:37 +00:00
agent: Fix fd leaks in execute_hook
Fixes: #480 Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
parent
ec84a94a61
commit
06834931a6
@ -1495,6 +1495,11 @@ fn execute_hook(logger: &Logger, h: &Hook, st: &OCIState) -> Result<()> {
|
||||
// state.push_str("\n");
|
||||
|
||||
let (rfd, wfd) = unistd::pipe2(OFlag::O_CLOEXEC)?;
|
||||
defer!({
|
||||
let _ = unistd::close(rfd);
|
||||
let _ = unistd::close(wfd);
|
||||
});
|
||||
|
||||
match unistd::fork()? {
|
||||
ForkResult::Parent { child: _ch } => {
|
||||
let buf = read_sync(rfd)?;
|
||||
|
Loading…
Reference in New Issue
Block a user