1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

Remove the existing socket if present

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
David Mulder 2024-08-23 14:07:08 -06:00
parent 066576e7c8
commit cb23d6a15e

View File

@ -145,15 +145,21 @@ async fn main() -> ExitCode {
}
};
let sock_dir = Path::new(&sock_dir_str);
let mut sock_path = PathBuf::from(sock_dir);
sock_path.push("hb_pipe");
let sock_path = match sock_path.to_str() {
let mut sock_path_buf = PathBuf::from(sock_dir);
sock_path_buf.push("hb_pipe");
let sock_path = match sock_path_buf.to_str() {
Some(sock_path) => sock_path,
None => {
talloc::TALLOC_FREE!(frame);
return ExitCode::FAILURE;
}
};
if sock_path_buf.exists() {
DBG_DEBUG!("Cleaning up socket from previous invocations");
if let Err(_) = std::fs::remove_file(sock_path) {
DBG_ERR!("Failed removing socket");
}
}
// Initialize the Himmelblau cache
let private_cache_path = match lp.private_path("himmelblau.tdb") {