From c57b2de035bee7d9e4438cf11df097f89cb948bc Mon Sep 17 00:00:00 2001 From: MatrixFurry Date: Sun, 23 Aug 2026 16:34:36 -0500 Subject: [PATCH] fix: resolve symlinks before getcap/setcap This fixes issues with getting or setting capabilities when the xrservice path is a symlink. --- src/util/file_utils.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/util/file_utils.rs b/src/util/file_utils.rs index 9b0fccf..e990cbf 100644 --- a/src/util/file_utils.rs +++ b/src/util/file_utils.rs @@ -107,7 +107,11 @@ pub fn setcap_cap_sys_nice_eip_cmd(xrservice_binary: &Path) -> Vec { vec![ setcap_executable().unwrap_or("setcap".into()), "CAP_SYS_NICE=eip".into(), - xrservice_binary.to_string_lossy().to_string(), + xrservice_binary + .canonicalize() + .unwrap_or_else(|_| xrservice_binary.to_path_buf()) + .to_string_lossy() + .to_string(), ] } @@ -121,7 +125,12 @@ pub enum VerifyCapSysNiceEipErr { pub async fn verify_cap_sys_nice_eip( xrservice_binary: &Path, ) -> Result { - let xrservice_binary = xrservice_binary.to_string_lossy().to_string(); + let xrservice_binary = xrservice_binary + .canonicalize() + .unwrap_or_else(|_| xrservice_binary.to_path_buf()) + .to_string_lossy() + .to_string(); + if let Some(getcap_exec) = getcap_executable() { match async_process(&getcap_exec, Some(&[&xrservice_binary]), None).await { Err(e) => { -- 2.51.2