Imported Upstream version 17.28.8
[platform/upstream/libzypp.git] / zypp-core / base / LogControl.cc
index f2bed4f..faa7170 100644 (file)
@@ -672,6 +672,9 @@ namespace zypp
         {
           logControlValidFlag() = 1;
           std::call_once( flagReadEnvAutomatically, &LogControlImpl::readEnvVars, this);
+
+          // make sure the LogControl is invalidated when we fork
+          pthread_atfork( nullptr, nullptr, &LogControl::notifyFork );
         }
 
       public:
@@ -869,6 +872,11 @@ namespace zypp
       LogThread::instance().stop();
     }
 
+    void LogControl::notifyFork()
+    {
+      logger::logControlValidFlag () = 0;
+    }
+
     ///////////////////////////////////////////////////////////////////
     //
     // LogControl::TmpExcessive