lucab / libsystemd-rs

A pure-Rust client library to work with systemd
https://crates.io/crates/libsystemd
Other
106 stars 19 forks source link

logging: fix `connected_to_journal` logic #119

Closed lucab closed 1 year ago

lucab commented 1 year ago

This tweaks the conditional checks in connected_to_journal() logic, in order to avoid buggy cases. In particular, in case of errors we may have ended up comparing None values possibly coming from the two sides (env and stdout/stderr stat), thus returning a false positive to consumers. Let's instead change the logic to be more explicit in case of real positive results, and use a single fallback for all negative cases.

lucab commented 1 year ago

/cc @lunaryorn for review

I was re-reading this code for unrelated reasons, and I think I spotted a logic bug due to the use of .ok() transformers. Please double-check my current reading of it.