From baf28a1a8b63da61a4bff56262ec03d7599cc1a5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 5 Mar 2021 23:56:54 -0500 Subject: only warn if disabling PTRACE_ATTACH fails --- CHANGELOG.md | 7 +++++++ src/bin/rbw-agent/debugger.rs | 5 +++-- src/bin/rbw-agent/main.rs | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1885aa4..3df5d53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,15 @@ # Changelog +## [Unreleased] + +### Fixed + +* Fix non-Linux platforms (#44, rjc) + ## [1.1.0] - 2021-03-02 ### Added + * You can now `rbw config set pinentry pinentry-curses` to change the pinentry program used by `rbw` (#39, djmattyg007) diff --git a/src/bin/rbw-agent/debugger.rs b/src/bin/rbw-agent/debugger.rs index ebc43bd..59bbe50 100644 --- a/src/bin/rbw-agent/debugger.rs +++ b/src/bin/rbw-agent/debugger.rs @@ -12,11 +12,12 @@ pub fn disable_tracing() -> anyhow::Result<()> { if ret == 0 { Ok(()) } else { - Err(anyhow::anyhow!("rbw-agent: Failed to disable PTRACE_ATTACH. Agent memory may be dumpable by other processes.")) + let e = nix::Error::last(); + Err(anyhow::anyhow!("failed to disable PTRACE_ATTACH, agent memory may be dumpable by other processes: {}", e)) } } #[cfg(not(target_os = "linux"))] pub fn disable_tracing() -> anyhow::Result<()> { - Err(anyhow::anyhow!("rbw-agent: Unable to disable PTRACE_ATTACH on this platform: not implemented. Agent memory may be dumpable by other processes.")) + Err(anyhow::anyhow!("failed to disable PTRACE_ATTACH, agent memory may be dumpable by other processes: unimplemented on this platform")) } diff --git a/src/bin/rbw-agent/main.rs b/src/bin/rbw-agent/main.rs index 5eedc30..74ee258 100644 --- a/src/bin/rbw-agent/main.rs +++ b/src/bin/rbw-agent/main.rs @@ -29,7 +29,9 @@ fn real_main() -> anyhow::Result<()> { ) .init(); - debugger::disable_tracing()?; + 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" -- cgit v1.2.3