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 <dinechin@redhat.com>
This commit is contained in:
Christophe de Dinechin 2020-09-17 19:47:52 +02:00
parent c635c46a4b
commit d5b492a1e7

View File

@ -23,7 +23,8 @@ macro_rules! log_child {
let lfd = $fd; let lfd = $fd;
let mut log_str = format_args!($($arg)+).to_string(); let mut log_str = format_args!($($arg)+).to_string();
log_str.push('\n'); 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());
}) })
} }