diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-02-22 13:42:18 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-02-22 13:42:18 +0100 |
| commit | a08f3a51979fbf8f34278e172a66ef69e5cb41f2 (patch) | |
| tree | 77a941f93f753d608ae9ebebb8d54ff244caf42b | |
| parent | e7eacb914d167e691e93781d0ff14069160f1e43 (diff) | |
| parent | f60a9c9ab3578e74284956656831fed009897148 (diff) | |
| download | mullvadvpn-a08f3a51979fbf8f34278e172a66ef69e5cb41f2.tar.xz mullvadvpn-a08f3a51979fbf8f34278e172a66ef69e5cb41f2.zip | |
Merge branch 'uniqueness-check-before-logrotate' into main
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | mullvad-daemon/src/main.rs | 20 |
2 files changed, 12 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ba97004d71..b84f108f62 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 80f15bb755..0b6a793560 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<PathBuf>) -> Result } async fn run_standalone(log_dir: Option<PathBuf>) -> 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 { |
