diff options
| -rw-r--r-- | mullvad-daemon/src/shutdown.rs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/mullvad-daemon/src/shutdown.rs b/mullvad-daemon/src/shutdown.rs index 2e7473b34f..7f7c09315e 100644 --- a/mullvad-daemon/src/shutdown.rs +++ b/mullvad-daemon/src/shutdown.rs @@ -32,19 +32,15 @@ mod platform { /// be assumed that the machine is shutting down. #[cfg(target_os = "linux")] pub fn is_shutdown_user_initiated() -> bool { - match talpid_dbus::systemd::is_host_running() { - Ok(is_host_running) => is_host_running, - Err(err) => { - log::error!( - "{}", - talpid_types::ErrorExt::display_chain_with_msg( - &err, - "Failed to determine if host is shutting down, assuming it is shutting down" - ) - ); - false - } - } + use talpid_types::ErrorExt; + talpid_dbus::systemd::is_host_running() + .map_err(|err| { + err.display_chain_with_msg( + "Failed to determine if host is shutting down, assuming it is shutting down", + ) + }) + .inspect_err(|err| log::error!("{err}")) + .unwrap_or(false) } /// Currently returns false all of the time to ensure that no leaks occur during shutdown. |
