Packets: Fix VariantParser invalid parser access bug
[senf.git] / Utils / Daemon / Daemon.cc
index 2b09cc0..93bfba5 100644 (file)
@@ -31,6 +31,7 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <unistd.h>
+#include <limits.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <signal.h>
@@ -363,6 +364,15 @@ prefix_ void senf::Daemon::fork()
     ::sigemptyset(&cldsig);
     LIBC_CALL( ::sigaddset, (&cldsig, SIGCHLD) );
     LIBC_CALL( ::sigprocmask, (SIG_BLOCK, &cldsig, &oldsig) );
+
+    if (! senf::scheduler::empty() )
+        std::cerr << 
+            "\n"
+            "*** WARNING ***\n"
+            "Scheduler not empty before fork(). THIS MUST NOT HAPPEN.\n"
+            "The scheduler will be reinitialized by the fork() and lose all registrations.\n"
+            "*** WARNING ***\n"
+            "\n";
     
     LIBC_CALL_RV( pid, ::fork, () );
 
@@ -563,7 +573,7 @@ prefix_ senf::detail::DaemonWatcher::DaemonWatcher(int pid, int coutpipe, int ce
     : childPid_(pid), coutpipe_(coutpipe), cerrpipe_(cerrpipe), stdout_(stdout),
       stderr_(stderr), sigChld_(false),
       cldSignal_ (SIGCHLD, senf::membind(&DaemonWatcher::sigChld, this)),
-      timer_ ("DaemanWatcher watchdog", senf::membind(&DaemonWatcher::childOk, this)),
+      timer_ ("senf::detail::DaemonWatcher::childOk", senf::membind(&DaemonWatcher::childOk, this)),
       coutForwarder_(coutpipe_, boost::bind(&DaemonWatcher::pipeClosed, this, 1)), 
       cerrForwarder_(cerrpipe_, boost::bind(&DaemonWatcher::pipeClosed, this, 2)) 
 {
@@ -631,7 +641,7 @@ prefix_ void senf::detail::DaemonWatcher::childOk()
 
 prefix_ senf::detail::DaemonWatcher::Forwarder::Forwarder(int src, Callback cb)
     : src_(src), cb_(cb), 
-      readevent_("DaemanWatcher::Forwarder", senf::membind(&Forwarder::readData, this),
+      readevent_("senf::detail::DaemonWatcher::Forwarder::readevent", senf::membind(&Forwarder::readData, this),
                  src_, scheduler::FdEvent::EV_READ)
 {}