mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 23:38:31 +00:00
agent: Fix stream fd's double close problem
The fd would be closed on Pipestream's dropping and we should not close it agian. Fixes: #4752 Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
parent
e764a726ab
commit
f5aa6ae467
@ -28,7 +28,6 @@ macro_rules! close_process_stream {
|
|||||||
($self: ident, $stream:ident, $stream_type: ident) => {
|
($self: ident, $stream:ident, $stream_type: ident) => {
|
||||||
if $self.$stream.is_some() {
|
if $self.$stream.is_some() {
|
||||||
$self.close_stream(StreamType::$stream_type);
|
$self.close_stream(StreamType::$stream_type);
|
||||||
let _ = unistd::close($self.$stream.unwrap());
|
|
||||||
$self.$stream = None;
|
$self.$stream = None;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -225,7 +224,7 @@ impl Process {
|
|||||||
Some(writer)
|
Some(writer)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn close_stream(&mut self, stream_type: StreamType) {
|
fn close_stream(&mut self, stream_type: StreamType) {
|
||||||
let _ = self.readers.remove(&stream_type);
|
let _ = self.readers.remove(&stream_type);
|
||||||
let _ = self.writers.remove(&stream_type);
|
let _ = self.writers.remove(&stream_type);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user