]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3506] Close lock file descriptor
authorFrancis Dupont <fdupont@isc.org>
Sun, 1 Sep 2024 20:45:03 +0000 (22:45 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 20 Sep 2024 12:55:54 +0000 (14:55 +0200)
src/lib/config/unix_command_mgr.cc

index e83bb549dd662155d3290e0c7d457b366b51f47e..221786e29b719ce3c3df3c5efe026c51dca8bf40 100644 (file)
@@ -573,6 +573,9 @@ UnixCommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr& socket_i
 
     // First let's open lock file.
     std::string lock_name = getLockName();
+    if (lock_fd_ != 1) {
+        close(lock_fd_);
+    }
     lock_fd_ = open(lock_name.c_str(), O_RDONLY | O_CREAT, 0600);
     if (lock_fd_ == -1) {
         std::string errmsg = strerror(errno);