[Libreoffice-commits] online.git: loolwsd/Auth.hpp loolwsd/Capabilities.hpp loolwsd/ChildProcessSession.cpp loolwsd/LoadTest.cpp loolwsd/LOOLBroker.cpp loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp
Tor Lillqvist
tml at collabora.com
Wed Mar 2 06:48:09 UTC 2016
loolwsd/Auth.hpp | 3 ++-
loolwsd/Capabilities.hpp | 8 +++++---
loolwsd/ChildProcessSession.cpp | 2 +-
loolwsd/LOOLBroker.cpp | 23 ++++++++++++-----------
loolwsd/LOOLKit.cpp | 19 ++++++++++---------
loolwsd/LOOLWSD.cpp | 4 ++--
loolwsd/LoadTest.cpp | 3 ++-
7 files changed, 34 insertions(+), 28 deletions(-)
New commits:
commit 02913dcbfc6fc63f6d5f9be4271509967f7b2f01
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Mar 2 08:47:13 2016 +0200
Use std:: consistently for cstdlib functions
diff --git a/loolwsd/Auth.hpp b/loolwsd/Auth.hpp
index c234243..c968ece 100644
--- a/loolwsd/Auth.hpp
+++ b/loolwsd/Auth.hpp
@@ -11,6 +11,7 @@
#ifndef INCLUDED_AUTH_HPP
#define INCLUDED_AUTH_HPP
+#include <cstdlib>
#include <string>
#include <Poco/Net/HTTPClientSession.h>
@@ -86,7 +87,7 @@ public:
//TODO: Parse the response.
/*
// This is used for the demo site.
- const auto lastLogTime = strtoul(reply.c_str(), nullptr, 0);
+ const auto lastLogTime = std::strtoul(reply.c_str(), nullptr, 0);
if (lastLogTime < 1)
{
//TODO: Redirect to login page.
diff --git a/loolwsd/Capabilities.hpp b/loolwsd/Capabilities.hpp
index dc94540..1ebb710 100644
--- a/loolwsd/Capabilities.hpp
+++ b/loolwsd/Capabilities.hpp
@@ -12,6 +12,8 @@
#include <sys/capability.h>
+#include <cstdlib>
+
#include "Util.hpp"
static
@@ -24,7 +26,7 @@ void dropCapability(cap_value_t capability)
if (caps == nullptr)
{
Log::error("Error: cap_get_proc() failed.");
- exit(1);
+ std::exit(1);
}
char *capText = cap_to_text(caps, nullptr);
@@ -35,13 +37,13 @@ void dropCapability(cap_value_t capability)
cap_set_flag(caps, CAP_PERMITTED, sizeof(cap_list)/sizeof(cap_list[0]), cap_list, CAP_CLEAR) == -1)
{
Log::error("Error: cap_set_flag() failed.");
- exit(1);
+ std::exit(1);
}
if (cap_set_proc(caps) == -1)
{
Log::error("Error: cap_set_proc() failed.");
- exit(1);
+ std::exit(1);
}
capText = cap_to_text(caps, nullptr);
diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index 7f037b8..926b4dc 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -313,7 +313,7 @@ ChildProcessSession::ChildProcessSession(const std::string& id,
std::function<void(const std::string&)> onUnload) :
LOOLSession(id, Kind::ToMaster, ws),
_loKitDocument(loKitDocument),
- _multiView(getenv("LOK_VIEW_CALLBACK")),
+ _multiView(std::getenv("LOK_VIEW_CALLBACK")),
_jailId(jailId),
_viewId(0),
_clientPart(0),
diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index ddeb815..b119ffd 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -9,6 +9,7 @@
#include <sys/wait.h>
+#include <cstdlib>
#include <cstring>
#include "Common.hpp"
@@ -694,31 +695,31 @@ int main(int argc, char** argv)
if (loSubPath.empty())
{
Log::error("Error: --losubpath is empty");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
if (sysTemplate.empty())
{
Log::error("Error: --systemplate is empty");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
if (loTemplate.empty())
{
Log::error("Error: --lotemplate is empty");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
if (childRoot.empty())
{
Log::error("Error: --childroot is empty");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
if (numPreSpawnedChildren < 1)
{
Log::error("Error: --numprespawns is 0");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
const Path pipePath = Path::forDirectory(childRoot + Path::separator() + FIFO_PATH);
@@ -726,7 +727,7 @@ int main(int argc, char** argv)
if ( (readerBroker = open(pipeLoolwsd.c_str(), O_RDONLY) ) < 0 )
{
Log::error("Error: failed to open pipe [" + pipeLoolwsd + "] read only. Exiting.");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
try
@@ -752,26 +753,26 @@ int main(int argc, char** argv)
if (mkfifo(pipeBroker.c_str(), 0666) < 0 && errno != EEXIST)
{
Log::error("Error: Failed to create pipe FIFO [" + FIFO_BROKER + "].");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
if ((readerChild = open(pipeBroker.c_str(), pipeFlags) ) < 0)
{
Log::error("Error: pipe opened for reading.");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
if ((pipeFlags = fcntl(readerChild, F_GETFL, 0)) < 0)
{
Log::error("Error: failed to get pipe flags [" + FIFO_BROKER + "].");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
pipeFlags &= ~O_NONBLOCK;
if (fcntl(readerChild, F_SETFL, pipeFlags) < 0)
{
Log::error("Error: failed to set pipe flags [" + FIFO_BROKER + "].");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
// Initialize LoKit and hope we can fork and save memory by sharing pages.
@@ -789,7 +790,7 @@ int main(int argc, char** argv)
loTemplate, loSubPath) < 0)
{
Log::error("Error: failed to create children.");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
if (numPreSpawnedChildren > 1)
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index f89a324..ca340d6 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -21,6 +21,7 @@
#include <dlfcn.h>
#include <atomic>
+#include <cstdlib>
#include <cstring>
#include <iostream>
#include <memory>
@@ -95,7 +96,7 @@ namespace
{
Log::error("Error: link(\"" + std::string(fpath) + "\",\"" + newPath.toString() +
"\") failed. Exiting.");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
break;
case FTW_DP:
@@ -307,7 +308,7 @@ public:
Document(LibreOfficeKit *loKit,
const std::string& jailId,
const std::string& url)
- : _multiView(getenv("LOK_VIEW_CALLBACK")),
+ : _multiView(std::getenv("LOK_VIEW_CALLBACK")),
_loKit(loKit),
_jailId(jailId),
_url(url),
@@ -799,7 +800,7 @@ void lokit_main(const std::string& childRoot,
if ((readerBroker = open(pipe.c_str(), O_RDONLY) ) < 0)
{
Log::error("Error: failed to open pipe [" + pipe + "] read only.");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
const Path pipePath = Path::forDirectory(childRoot + Path::separator() + FIFO_PATH);
@@ -807,7 +808,7 @@ void lokit_main(const std::string& childRoot,
if ((writerBroker = open(pipeBroker.c_str(), O_WRONLY) ) < 0)
{
Log::error("Error: failed to open pipe [" + FIFO_BROKER + "] write only.");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
const Path jailPath = Path::forDirectory(childRoot + Path::separator() + jailId);
@@ -875,13 +876,13 @@ void lokit_main(const std::string& childRoot,
if (chroot(jailPath.toString().c_str()) == -1)
{
Log::error("Error: chroot(\"" + jailPath.toString() + "\") failed.");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
if (chdir("/") == -1)
{
Log::error("Error: chdir(\"/\") in jail failed.");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
dropCapability(CAP_SYS_CHROOT);
@@ -892,7 +893,7 @@ void lokit_main(const std::string& childRoot,
if (loKit == nullptr)
{
Log::error("Error: LibreOfficeKit initialization failed. Exiting.");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
Log::info("loolkit [" + std::to_string(Process::id()) + "] is ready.");
@@ -1102,13 +1103,13 @@ int main(int argc, char** argv)
if (loSubPath.empty())
{
Log::error("Error: --losubpath is empty");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
if (pipe.empty())
{
Log::error("Error: --pipe is empty");
- exit(Application::EXIT_SOFTWARE);
+ std::exit(Application::EXIT_SOFTWARE);
}
try
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index c5d3cc3..4d8558b 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -841,12 +841,12 @@ void LOOLWSD::handleOption(const std::string& optionName, const std::string& val
if (optionName == "help")
{
displayHelp();
- exit(Application::EXIT_OK);
+ std::exit(Application::EXIT_OK);
}
else if (optionName == "version")
{
displayVersion();
- exit(Application::EXIT_OK);
+ std::exit(Application::EXIT_OK);
}
else if (optionName == "port")
ClientPortNumber = std::stoi(value);
diff --git a/loolwsd/LoadTest.cpp b/loolwsd/LoadTest.cpp
index f9df891..edf93c8 100644
--- a/loolwsd/LoadTest.cpp
+++ b/loolwsd/LoadTest.cpp
@@ -10,6 +10,7 @@
#include <unistd.h>
#include <algorithm>
+#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
@@ -356,7 +357,7 @@ void LoadTest::handleOption(const std::string& optionName, const std::string& va
if (optionName == "help")
{
displayHelp();
- exit(Application::EXIT_OK);
+ std::exit(Application::EXIT_OK);
}
else if (optionName == "doclist")
_docList = readDocList(value);
More information about the Libreoffice-commits
mailing list