[Libreoffice-commits] online.git: 4 commits - loolwsd/LOKitClient.cpp loolwsd/LOOLForKit.cpp loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp

Tor Lillqvist tml at collabora.com
Fri Apr 8 09:04:05 UTC 2016


 loolwsd/LOKitClient.cpp |    2 +-
 loolwsd/LOOLForKit.cpp  |    2 +-
 loolwsd/LOOLKit.cpp     |   19 ++++++++++---------
 loolwsd/LOOLWSD.cpp     |    8 ++++----
 4 files changed, 16 insertions(+), 15 deletions(-)

New commits:
commit 481afd03068ddbaf7768b96dc854d0b0f9e00c83
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 8 11:48:02 2016 +0300

    Exit bluntly in all cases from a loolkit process

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 50637ec..82e81ac 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -20,9 +20,10 @@
 #include <atomic>
 #include <cassert>
 #include <condition_variable>
+#include <cstdlib>
 #include <iostream>
-
 #include <memory>
+
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKitInit.h>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -120,7 +121,7 @@ namespace
             {
                 Log::syserror("link(\"" + std::string(fpath) + "\",\"" + newPath.toString() +
                            "\") failed. Exiting.");
-                std::exit(Application::EXIT_SOFTWARE);
+                std::_Exit(Application::EXIT_SOFTWARE);
             }
             break;
         case FTW_D:
@@ -186,7 +187,7 @@ namespace
         if (caps == nullptr)
         {
             Log::syserror("cap_get_proc() failed.");
-            std::exit(1);
+            std::_Exit(1);
         }
 
         char *capText = cap_to_text(caps, nullptr);
@@ -197,13 +198,13 @@ namespace
             cap_set_flag(caps, CAP_PERMITTED, sizeof(cap_list)/sizeof(cap_list[0]), cap_list, CAP_CLEAR) == -1)
         {
             Log::syserror("cap_set_flag() failed.");
-            std::exit(1);
+            std::_Exit(1);
         }
 
         if (cap_set_proc(caps) == -1)
         {
             Log::syserror("cap_set_proc() failed.");
-            std::exit(1);
+            std::_Exit(1);
         }
 
         capText = cap_to_text(caps, nullptr);
@@ -983,13 +984,13 @@ void lokit_main(const std::string& childRoot,
         if (chroot(jailPath.toString().c_str()) == -1)
         {
             Log::syserror("chroot(\"" + jailPath.toString() + "\") failed.");
-            std::exit(Application::EXIT_SOFTWARE);
+            std::_Exit(Application::EXIT_SOFTWARE);
         }
 
         if (chdir("/") == -1)
         {
             Log::syserror("chdir(\"/\") in jail failed.");
-            std::exit(Application::EXIT_SOFTWARE);
+            std::_Exit(Application::EXIT_SOFTWARE);
         }
 
         dropCapability(CAP_SYS_CHROOT);
@@ -1002,7 +1003,7 @@ void lokit_main(const std::string& childRoot,
         if (loKit == nullptr)
         {
             Log::error("LibreOfficeKit initialization failed. Exiting.");
-            std::exit(Application::EXIT_SOFTWARE);
+            std::_Exit(Application::EXIT_SOFTWARE);
         }
 
         Log::info("Process is ready.");
@@ -1076,7 +1077,7 @@ void lokit_main(const std::string& childRoot,
     }
 
     Log::info("Process finished.");
-    _exit(Application::EXIT_OK);
+    std::_Exit(Application::EXIT_OK);
 }
 
 /// Initializes LibreOfficeKit for cross-fork re-use.
commit 84650ea2df32b5fb79bbd597888b3c74d1ed0dac
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 8 11:46:42 2016 +0300

    Use std:: prefix for cstdlib functions

diff --git a/loolwsd/LOKitClient.cpp b/loolwsd/LOKitClient.cpp
index 50cf3ec..63a725d 100644
--- a/loolwsd/LOKitClient.cpp
+++ b/loolwsd/LOKitClient.cpp
@@ -194,7 +194,7 @@ protected:
         }
 
         // Safest to just bluntly exit
-        _Exit(Application::EXIT_OK);
+        std::_Exit(Application::EXIT_OK);
     }
 };
 
commit e026a7073bfafa0582dce0712929a5b12a6eca56
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 8 11:43:30 2016 +0300

    We don't need _exit here
    
    This is called in the parent loolforkit process. It's in the loolkit
    processes that we want to do the blunt exits, I assume.

diff --git a/loolwsd/LOOLForKit.cpp b/loolwsd/LOOLForKit.cpp
index cde3c14..9daec90 100644
--- a/loolwsd/LOOLForKit.cpp
+++ b/loolwsd/LOOLForKit.cpp
@@ -210,7 +210,7 @@ int main(int argc, char** argv)
 
     // Initialize LoKit
     if (!globalPreinit(loTemplate))
-        _exit(Application::EXIT_SOFTWARE);
+        std::exit(Application::EXIT_SOFTWARE);
 
     Log::info("Preinit stage OK.");
 
commit 756363e4dcb0de0ee5a51357c64284043ea93a67
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 8 11:42:14 2016 +0300

    Consistency

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index f7798f4..45ddac2 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1319,26 +1319,26 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
     if (mkfifo(pipeNotify.c_str(), 0666) < 0 && errno != EEXIST)
     {
         Log::syserror("Failed to create pipe FIFO [" + std::string(FIFO_ADMIN_NOTIFY) + "].");
-        exit(Application::EXIT_SOFTWARE);
+        std::exit(Application::EXIT_SOFTWARE);
     }
 
     if ((notifyPipe = open(pipeNotify.c_str(), pipeFlags) ) < 0)
     {
         Log::syserror("Failed to open pipe for reading.");
-        exit(Application::EXIT_SOFTWARE);
+        std::exit(Application::EXIT_SOFTWARE);
     }
 
     if ((pipeFlags = fcntl(notifyPipe, F_GETFL, 0)) < 0)
     {
         Log::syserror("Failed to get pipe flags [" + std::string(FIFO_ADMIN_NOTIFY) + "].");
-        exit(Application::EXIT_SOFTWARE);
+        std::exit(Application::EXIT_SOFTWARE);
     }
 
     pipeFlags &= ~O_NONBLOCK;
     if (fcntl(notifyPipe, F_SETFL, pipeFlags) < 0)
     {
         Log::syserror("Failed to set pipe flags [" + std::string(FIFO_ADMIN_NOTIFY) + "].");
-        exit(Application::EXIT_SOFTWARE);
+        std::exit(Application::EXIT_SOFTWARE);
     }
 
     const Process::PID forKitPid = createForKit();


More information about the Libreoffice-commits mailing list