mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-26 19:48:56 +00:00
Merge pull request #6680 from Tim-Zhang/fix-ut-bad-fd
agent: Fix ut issue caused by fd double closed
This commit is contained in:
commit
ceefd50bd0
@ -442,9 +442,8 @@ mod tests {
|
|||||||
let msg = format!("test[{}]: {:?}", i, d);
|
let msg = format!("test[{}]: {:?}", i, d);
|
||||||
let (rfd, wfd) = unistd::pipe2(OFlag::O_CLOEXEC).unwrap();
|
let (rfd, wfd) = unistd::pipe2(OFlag::O_CLOEXEC).unwrap();
|
||||||
defer!({
|
defer!({
|
||||||
// rfd is closed by the use of PipeStream in the crate_logger_task function,
|
// XXX: Never try to close rfd, because it will be closed by PipeStream in
|
||||||
// but we will attempt to close in case of a failure
|
// create_logger_task() and it's not safe to close the same fd twice time.
|
||||||
let _ = unistd::close(rfd);
|
|
||||||
unistd::close(wfd).unwrap();
|
unistd::close(wfd).unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user