From 942999edb93997477db5bb751b5848a7ce26b9f2 Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Tue, 29 Sep 2020 14:47:13 +0800 Subject: [PATCH] agent: Change do_exec return type to ! because it will never return Indicates unreachable code. Fixes #819 Signed-off-by: Tim Zhang --- src/agent/rustjail/src/container.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/agent/rustjail/src/container.rs b/src/agent/rustjail/src/container.rs index b3b89fe0bf..50615c7ffe 100644 --- a/src/agent/rustjail/src/container.rs +++ b/src/agent/rustjail/src/container.rs @@ -1022,7 +1022,7 @@ where }) } -fn do_exec(args: &[String]) -> Result<()> { +fn do_exec(args: &[String]) -> ! { let path = &args[0]; let p = CString::new(path.to_string()).unwrap(); let sa: Vec = args @@ -1041,8 +1041,8 @@ fn do_exec(args: &[String]) -> Result<()> { _ => std::process::exit(-2), } } - // should never reach here - Ok(()) + + unreachable!() } fn update_namespaces(logger: &Logger, spec: &mut Spec, init_pid: RawFd) -> Result<()> {