forked from proxmox-mirrors/proxmox
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 <t.lamprecht@proxmox.com>
This commit is contained in:
parent
7648aabf42
commit
1db49cb269
@ -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)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user