From 86d384da7afb63a07cf4d506edb71b7e8656a514 Mon Sep 17 00:00:00 2001 From: Thomas Markwalder Date: Tue, 4 Feb 2020 09:35:48 -0500 Subject: [PATCH] [#1097] Addresses review comments Minor cleanups --- src/lib/config/command_mgr.cc | 6 ++---- src/lib/config/tests/command_mgr_unittests.cc | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lib/config/command_mgr.cc b/src/lib/config/command_mgr.cc index 0ff2c5d850..945b198c24 100644 --- a/src/lib/config/command_mgr.cc +++ b/src/lib/config/command_mgr.cc @@ -490,7 +490,7 @@ public: /// @brief Returns the lock file name std::string getLockName() { - return(std::string(socket_name_ + ".lock")); + return (std::string(socket_name_ + ".lock")); } /// @brief Pointer to the IO service used by the server process for running @@ -549,7 +549,6 @@ CommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr& socket_info) // First let's open lock file. std::string lock_name = getLockName(); - errno = 0; int lock_fd = open(lock_name.c_str(), O_RDONLY | O_CREAT, 0600); if (lock_fd == -1) { std::string errmsg = strerror(errno); @@ -559,7 +558,6 @@ CommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr& socket_info) // Try to acquire lock. If we can't somebody else is actively // using it. - errno = 0; int ret = flock(lock_fd, LOCK_EX | LOCK_NB); if (ret != 0) { std::string errmsg = strerror(errno); @@ -568,7 +566,7 @@ CommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr& socket_info) } // We have the lock, so let's remove the pre-existing socket - // file if it's exists. + // file if it exists. static_cast(::remove(socket_name_.c_str())); LOG_INFO(command_logger, COMMAND_ACCEPTOR_START) diff --git a/src/lib/config/tests/command_mgr_unittests.cc b/src/lib/config/tests/command_mgr_unittests.cc index 419cdf3cfd..b607d3e414 100644 --- a/src/lib/config/tests/command_mgr_unittests.cc +++ b/src/lib/config/tests/command_mgr_unittests.cc @@ -17,7 +17,6 @@ #include #include #include -#include #include #include