]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1657] addressed comments
authorRazvan Becheriu <razvan@isc.org>
Mon, 22 Feb 2021 14:50:15 +0000 (16:50 +0200)
committerRazvan Becheriu <razvan@isc.org>
Mon, 22 Feb 2021 16:02:57 +0000 (16:02 +0000)
src/bin/dhcp6/dhcp6_srv.cc
src/lib/asiolink/process_spawn.cc
src/lib/util/thread_pool.h
src/lib/util/watched_thread.cc

index 40a81ef5f97bd9cb5922266a8c60e2d2d231f0fe..1173b6cb4dd2a75a1d716b8b3677e662e5320fab 100644 (file)
@@ -576,8 +576,8 @@ void Dhcpv6Srv::run_one() {
     } catch (const SignalInterruptOnSelect&) {
         // Packet reception interrupted because a signal has been received.
         // This is not an error because we might have received a SIGTERM,
-        // SIGINT or SIGHUP which are handled by the server. For signals
-        // that are not handled by the server we rely on the default
+        // SIGINT, SIGHUP or SIGCHLD which are handled by the server. For
+        // signals that are not handled by the server we rely on the default
         // behavior of the system.
         LOG_DEBUG(packet6_logger, DBG_DHCP6_DETAIL, DHCP6_BUFFER_WAIT_SIGNAL);
     } catch (const std::exception& e) {
index 91ee8f326c291f19888c5d51d572395ffd9bf310..fd0f4f43e3d7a0b109e1a1ffe79c30f3999f0426 100644 (file)
@@ -241,23 +241,13 @@ ProcessSpawnImpl::getCommandLine() const {
 
 pid_t
 ProcessSpawnImpl::spawn(bool dismiss) {
-    // Protect us against SIGCHLD signals
-    sigset_t sset;
-    sigset_t osset;
-    sigemptyset(&sset);
-    sigaddset(&sset, SIGCHLD);
-    pthread_sigmask(SIG_BLOCK, &sset, &osset);
     lock_guard<std::mutex> lk(mutex_);
     // Create the child
     pid_t pid = fork();
     if (pid < 0) {
-        pthread_sigmask(SIG_SETMASK, &osset, 0);
         isc_throw(ProcessSpawnError, "unable to fork current process");
 
     } else if (pid == 0) {
-        // We're in the child process.
-        // Restore signal mask.
-        sigprocmask(SIG_SETMASK, &osset, 0);
         // Run the executable.
         if (execve(executable_.c_str(), args_.get(), vars_.get()) != 0) {
             // We may end up here if the execve failed, e.g. as a result
@@ -270,17 +260,9 @@ ProcessSpawnImpl::spawn(bool dismiss) {
 
     // We're in the parent process.
     if (!dismiss) {
-        try {
-            store_ = true;
-            process_collection_[this].insert(std::pair<pid_t, ProcessStatePtr>(pid, ProcessStatePtr(new ProcessState())));
-        } catch(...) {
-            // Restore signal mask.
-            pthread_sigmask(SIG_SETMASK, &osset, 0);
-            throw;
-        }
+        store_ = true;
+        process_collection_[this].insert(std::pair<pid_t, ProcessStatePtr>(pid, ProcessStatePtr(new ProcessState())));
     }
-    // Restore signal mask.
-    pthread_sigmask(SIG_SETMASK, &osset, 0);
     return (pid);
 }
 
index e5eb5d5ad872702d07211411d1264905d16dc549..7313ea73f0e1ab6fc4f3ae2d692dc7f9a1d5d5bf 100644 (file)
@@ -176,7 +176,7 @@ private:
     /// @param thread_count specifies the number of threads to be created and
     /// started
     void startInternal(uint32_t thread_count) {
-        // Protect us against SIGCHLD signals
+        // Protect us against signals
         sigset_t sset;
         sigset_t osset;
         sigemptyset(&sset);
index a06aac7cbf6d5a4018e3dd3d4950599d752856f9..e9c3468df884bc4d5047230469e137d7aec31e48 100644 (file)
@@ -18,7 +18,7 @@ WatchedThread::start(const std::function<void()>& thread_main) {
     clearReady(READY);
     clearReady(TERMINATE);
     setErrorInternal("no error");
-    // Protect us against SIGCHLD signals
+    // Protect us against signals
     sigset_t sset;
     sigset_t osset;
     sigemptyset(&sset);