From 7fd0a9ca42f5185496cb856e738b65196a8838a8 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Tue, 23 Sep 2025 23:48:52 +0200 Subject: [PATCH] [#4090] Finished fix --- src/lib/dhcpsrv/memfile_lease_mgr.cc | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index e35f4dfa31..e6f85151d7 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -240,30 +240,12 @@ LFCSetup::execute(const std::string& lease_file) { try { // Look at lfc.dox for a description of this. - // Try to recover a deleted pid file. - bool is_running = false; - if (pid_ != 0) { - try { - is_running = isRunning(); - } catch (...) { - // Ignore errors. - } - } - // Do not trust the process spawn isRunning method. - if (is_running && (kill(pid_, 0) != 0)) { - is_running = false; - } - // Try to acquire the lock for the pid file. PIDLock pid_lock(pid_file.getLockname()); // Verify that no lfc is still running. - if (is_running || !pid_lock.isLocked() || pid_file.check()) { + if (!pid_lock.isLocked() || pid_file.check()) { LOG_INFO(dhcpsrv_logger, DHCPSRV_MEMFILE_LFC_RUNNING); - if (is_running && pid_lock.isLocked() && !pid_file.check()) { - // The pid file was deleted and the process is still running! - pid_file.write(pid_); - } return; } -- 2.47.3