Skip to content

Commit

Permalink
fix socket removal on start
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj authored and FlorentinDUBOIS committed Jul 13, 2022
1 parent e0b94bf commit 01ec16c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bin/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ impl CommandServer {
pub fn disable_cloexec_before_upgrade(&mut self) -> anyhow::Result<()> {
for ref mut worker in self.workers.iter_mut() {
if worker.run_state == RunState::Running {
let _ =util::disable_close_on_exec(worker.fd).map_err(|e| {
let _ = util::disable_close_on_exec(worker.fd).map_err(|e| {
error!(
"could not disable close on exec for worker {}: {}",
worker.id, e
Expand Down Expand Up @@ -548,8 +548,11 @@ pub fn start(
) -> anyhow::Result<()> {
let addr = PathBuf::from(&command_socket_path);

fs::remove_file(&addr)
.with_context(|| format!("could not delete previous socket at {:?}", addr))?;
if fs::metadata(&addr).is_ok() {
info!("A socket is already present. Deleting...");
fs::remove_file(&addr)
.with_context(|| format!("could not delete previous socket at {:?}", addr))?;
}

let srv = match UnixListener::bind(&addr) {
Err(e) => {
Expand Down

0 comments on commit 01ec16c

Please sign in to comment.