loolwsd/LOOLBroker.cpp | 8 ++++---- loolwsd/Util.cpp | 3 +++ loolwsd/Util.hpp | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-)
New commits: commit dc305b2b087a436bd612a9dd24fa4c407e7a1db1 Author: Tor Lillqvist <t...@collabora.com> Date: Tue Mar 1 16:43:39 2016 +0200 Don't confuse Poco::Util::Application::ExitCode and EXIT_SUCCESS/FAILURE The getChildStatus() and getSignalStatus() functions returned the latter, still the returned values were compared against Poco::Util::Application::EXIT_OK. (Sure, both Poco's Application::EXIT_SUCCESS and stdlib.h's EXIT_OK are zero, but that doesn't mean one should mix them up.) Also add two comments pondering the meaning of the code. diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 0269866..5718304 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -809,7 +809,7 @@ int main(int argc, char** argv) Log::info("loolbroker is ready."); - int childExitCode = Application::EXIT_OK; + int childExitCode = EXIT_SUCCESS; unsigned timeoutCounter = 0; while (!TerminationFlag) { @@ -876,7 +876,7 @@ int main(int argc, char** argv) // No child processes if (errno == ECHILD) { - if (childExitCode == Application::EXIT_OK) + if (childExitCode == EXIT_SUCCESS) { Log::warn("Warn: last child exited successfully, fork new one."); ++forkCounter; @@ -890,7 +890,7 @@ int main(int argc, char** argv) } } - if (forkCounter > 0 && childExitCode == Application::EXIT_OK) + if (forkCounter > 0 && childExitCode == EXIT_SUCCESS) { std::lock_guard<std::recursive_mutex> lock(forkMutex); @@ -917,7 +917,7 @@ int main(int argc, char** argv) if (timeoutCounter++ == INTERVAL_PROBES) { timeoutCounter = 0; - childExitCode = Application::EXIT_OK; + childExitCode = EXIT_SUCCESS; sleep(MAINTENANCE_INTERVAL); } } diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp index fab7a06..05d8032 100644 --- a/loolwsd/Util.cpp +++ b/loolwsd/Util.cpp @@ -496,6 +496,7 @@ namespace Util retVal = EXIT_SUCCESS; break; + // Why are other non-zero exit codes interpreted as success? default: retVal = EXIT_SUCCESS; break; @@ -522,6 +523,8 @@ namespace Util retVal = EXIT_FAILURE; break; + // Why are other signals treated as success? Will this function ever be called when a + // child was *not* terminated by a signal? default: retVal = EXIT_SUCCESS; break; diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp index b2e3840..481fe3e 100644 --- a/loolwsd/Util.hpp +++ b/loolwsd/Util.hpp @@ -116,7 +116,9 @@ namespace Util void setTerminationSignals(); void setFatalSignals(); + /// Returns EXIT_SUCCESS or EXIT_FAILURE from <stdlib.h> int getChildStatus(const int code); + /// Returns EXIT_SUCCESS or EXIT_FAILURE from <stdlib.h> int getSignalStatus(const int code); void requestTermination(const Poco::Process::PID& pid); commit f560c644714512cd0fe5ef35a093999bb522b32c Author: Tor Lillqvist <t...@collabora.com> Date: Tue Mar 1 16:34:32 2016 +0200 Document where LOOLExitCode comes from diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp index a3c95de..b2e3840 100644 --- a/loolwsd/Util.hpp +++ b/loolwsd/Util.hpp @@ -24,6 +24,9 @@ #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitEnums.h> +// This is an odd mix of the EExitCodes enum in LibreOffice's desktop/source/inc/exithelper.h and +// then EX_SOFTWARE (= 70) from the (BSD origin) <sysexits.h>. + enum class LOOLExitCode { LOOL_NO_ERROR = 0, commit 248703c6f7d04da47cc3c4742896ff1d010677c1 Author: Tor Lillqvist <t...@collabora.com> Date: Tue Mar 1 16:28:56 2016 +0200 Bin leftover declaration of variable that is not defined anywhere diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp index 19eaffe..a3c95de 100644 --- a/loolwsd/Util.hpp +++ b/loolwsd/Util.hpp @@ -24,9 +24,6 @@ #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitEnums.h> -// Possible states of LOOL processes. -enum class LOOLState { LOOL_RUNNING, LOOL_STOPPING, LOOL_ABNORMAL }; - enum class LOOLExitCode { LOOL_NO_ERROR = 0, @@ -42,8 +39,6 @@ enum class LOOLExitCode LOOL_EXIT_SOFTWARE = 70 }; -extern volatile LOOLState TerminationState; - /// Flag to stop pump loops. extern volatile bool TerminationFlag; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits