From 1db49cb26960113df34233991985150b672006b2 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 30 Dec 2024 15:30:08 +0100 Subject: [PATCH] daemon: try to remove existing unix socket in bind directly We tried this unconditionally on start-up in the PDM for the priv. API daemon, but we actually only want to clean-up on fresh bind, not on restoring the FD on daemon reload. Otherwise the unprivileged daemon cannot connect to the privileged one anymore after the latter got reloaded. Signed-off-by: Thomas Lamprecht --- proxmox-daemon/src/server.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proxmox-daemon/src/server.rs b/proxmox-daemon/src/server.rs index 30761cb3..7cf5ea06 100644 --- a/proxmox-daemon/src/server.rs +++ b/proxmox-daemon/src/server.rs @@ -303,6 +303,11 @@ impl Listenable for tokio::net::UnixListener { let addr = addr.as_pathname().ok_or_else(|| { io::Error::new(io::ErrorKind::Other, "missing path for unix socket") })?; + match std::fs::remove_file(addr) { + Ok(()) => (), + Err(err) if err.kind() == io::ErrorKind::NotFound => (), + Err(err) => Err(err)?, + } Self::bind(addr) }) }