From 0cbbf3b2e90c64748a180ae710ad798954cb89fa Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 6 Mar 2021 11:48:19 -0500 Subject: disable PTRACE_ATTACH after daemonizing this should let warnings go to the agent logs instead of the terminal --- CHANGELOG.md | 7 +++++++ src/bin/rbw-agent/main.rs | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4849a0e..36c8b06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [Unreleased] + +### Fixed + +* Send warnings about failure to disable PTRACE_ATTACH to the agent logs rather + than stderr + ## [1.1.1] - 2021-03-05 ### Fixed diff --git a/src/bin/rbw-agent/main.rs b/src/bin/rbw-agent/main.rs index 74ee258..69411ae 100644 --- a/src/bin/rbw-agent/main.rs +++ b/src/bin/rbw-agent/main.rs @@ -29,10 +29,6 @@ fn real_main() -> anyhow::Result<()> { ) .init(); - if let Err(e) = debugger::disable_tracing() { - log::warn!("{}", e); - } - let no_daemonize = if let Some(arg) = std::env::args().nth(1) { arg == "--no-daemonize" } else { @@ -45,6 +41,10 @@ fn real_main() -> anyhow::Result<()> { Some(daemon::daemonize().context("failed to daemonize")?) }; + if let Err(e) = debugger::disable_tracing() { + log::warn!("{}", e); + } + let (w, r) = std::sync::mpsc::channel(); // can't use tokio::main because we need to daemonize before starting the // tokio runloop, or else things break -- cgit v1.2.3-54-g00ecf