mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 12:44:39 +00:00
agent: re-enable the standard SIGPIPE behavior
The Rust standard library had suppressed the default SIGPIPE behavior, see https://github.com/rust-lang/rust/pull/13158. Since the parent's signal handler would be inherited by it's child process, thus we should re-enable the standard SIGPIPE behavior as a workaround. Fixes: #1887 Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
This commit is contained in:
parent
35f297ad50
commit
0ae364c8eb
@ -248,6 +248,7 @@ fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if args.len() == 2 && args[1] == "init" {
|
if args.len() == 2 && args[1] == "init" {
|
||||||
|
reset_sigpipe();
|
||||||
rustjail::container::init_child();
|
rustjail::container::init_child();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -358,5 +359,16 @@ fn sethostname(hostname: &OsStr) -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The Rust standard library had suppressed the default SIGPIPE behavior,
|
||||||
|
// see https://github.com/rust-lang/rust/pull/13158.
|
||||||
|
// Since the parent's signal handler would be inherited by it's child process,
|
||||||
|
// thus we should re-enable the standard SIGPIPE behavior as a workaround to
|
||||||
|
// fix the issue of https://github.com/kata-containers/kata-containers/issues/1887.
|
||||||
|
fn reset_sigpipe() {
|
||||||
|
unsafe {
|
||||||
|
libc::signal(libc::SIGPIPE, libc::SIG_DFL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
use crate::config::AgentConfig;
|
use crate::config::AgentConfig;
|
||||||
use std::os::unix::io::{FromRawFd, RawFd};
|
use std::os::unix::io::{FromRawFd, RawFd};
|
||||||
|
Loading…
Reference in New Issue
Block a user