From d5b492a1e755d3af68c185ca4543899d3919cfa8 Mon Sep 17 00:00:00 2001 From: Christophe de Dinechin Date: Thu, 17 Sep 2020 19:47:52 +0200 Subject: [PATCH] rust-agent: Ignore write errors while writing to the logs When we are writing to the logs and there is an error doing so, there is not much we can do. Chances are that a panic would make things worse. So let it go through. warning: unused `std::result::Result` that must be used --> rustjail/src/sync.rs:26:9 | 26 | write_count(lfd, log_str.as_bytes(), log_str.len()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ::: rustjail/src/container.rs:339:13 | 339 | log_child!(cfd_log, "child exit: {:?}", e); | ------------------------------------------- in this macro invocation | = note: this `Result` may be an `Err` variant, which should be handled = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) Fixes: #750 Signed-off-by: Christophe de Dinechin --- src/agent/rustjail/src/sync.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/agent/rustjail/src/sync.rs b/src/agent/rustjail/src/sync.rs index 20bf7b470..8ce43b270 100644 --- a/src/agent/rustjail/src/sync.rs +++ b/src/agent/rustjail/src/sync.rs @@ -23,7 +23,8 @@ macro_rules! log_child { let lfd = $fd; let mut log_str = format_args!($($arg)+).to_string(); log_str.push('\n'); - write_count(lfd, log_str.as_bytes(), log_str.len()); + // Ignore error writing to the logger, not much we can do + let _ = write_count(lfd, log_str.as_bytes(), log_str.len()); }) }