From 432e6785b21c1a0c78d80bb99ce9b66763bc287f Mon Sep 17 00:00:00 2001 From: Echo Date: Thu, 7 May 2026 01:42:20 +0000 Subject: [PATCH] fix: use resolved service name for socket activation detection --- Cargo.toml | 2 +- debian/changelog | 7 +++++++ src/packages/mod.rs | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7954d50..7125dd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "linux-patch-api" -version = "0.3.10" +version = "0.3.12" edition = "2021" authors = ["Echo "] description = "Secure remote package management API for Linux systems" diff --git a/debian/changelog b/debian/changelog index c55d691..ec62ece 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +linux-patch-api (0.3.12-1) unstable; urgency=low + + * Fix socket activation detection to use resolved service name + * Queries like "sshd" now correctly resolve to "ssh.socket" for socket activation + + -- Echo Tue, 06 May 2026 20:42:00 -0500 + linux-patch-api (0.3.10-1) unstable; urgency=low * Fix socket activation detection for service status healthy logic diff --git a/src/packages/mod.rs b/src/packages/mod.rs index f3ecb06..b267279 100644 --- a/src/packages/mod.rs +++ b/src/packages/mod.rs @@ -571,7 +571,9 @@ fn get_systemd_service_status(name: &str) -> Result> { // Check for socket activation: if service is inactive but enabled, // check if the corresponding .socket unit is active (listening) let healthy = if !healthy && active_state == "inactive" && unit_file_state == "enabled" { - let socket_name = format!("{}.socket", name.trim_end_matches(".service")); + // Use the resolved service name (id) instead of input name, + // so "sshd" resolves to "ssh.service" → "ssh.socket" correctly + let socket_name = format!("{}.socket", id.trim_end_matches(".service")); if let Ok(socket_output) = Command::new("systemctl") .args(["show", &socket_name, "--property=ActiveState", "--no-pager"]) .output()