diff --git a/CHANGELOG.md b/CHANGELOG.md index ba97004d7111..b84f108f62e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Line wrap the file at 100 chars. Th ### Fixed - Continual excessive attempts to update the API IP were made after testing access methods. - Fix pointless API access method rotations for concurrent requests. +- Fix daemon rotating logs on startup even if another daemon is already running. ### Security #### Android diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs index 80f15bb755d4..0b6a7935603e 100644 --- a/mullvad-daemon/src/main.rs +++ b/mullvad-daemon/src/main.rs @@ -23,6 +23,17 @@ const EARLY_BOOT_LOG_FILENAME: &str = "early-boot-fw.log"; fn main() { let config = cli::get_config(); + + let runtime = new_runtime_builder().build().unwrap_or_else(|error| { + eprintln!("{}", error.display_chain()); + std::process::exit(1); + }); + + if runtime.block_on(rpc_uniqueness_check::is_another_instance_running()) { + eprintln!("Another instance of the daemon is already running"); + std::process::exit(1) + } + let log_dir = init_daemon_logging(config).unwrap_or_else(|error| { eprintln!("{error}"); std::process::exit(1) @@ -30,11 +41,6 @@ fn main() { log::trace!("Using configuration: {:?}", config); - let runtime = new_runtime_builder().build().unwrap_or_else(|error| { - eprintln!("{}", error.display_chain()); - std::process::exit(1); - }); - let exit_code = match runtime.block_on(run_platform(config, log_dir)) { Ok(_) => 0, Err(error) => { @@ -144,10 +150,6 @@ async fn run_platform(_config: &cli::Config, log_dir: Option) -> Result } async fn run_standalone(log_dir: Option) -> Result<(), String> { - if rpc_uniqueness_check::is_another_instance_running().await { - return Err("Another instance of the daemon is already running".to_owned()); - } - #[cfg(any(target_os = "macos", target_os = "linux"))] if let Err(err) = tokio::fs::remove_file(mullvad_paths::get_rpc_socket_path()).await { if err.kind() != std::io::ErrorKind::NotFound {