[Libreoffice-commits] online.git: Branch 'private/hcvcastro/forking' - loolwsd/LOOLBroker.cpp
Henry Castro
hcastro at collabora.com
Sun Sep 27 14:40:01 PDT 2015
loolwsd/LOOLBroker.cpp | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
New commits:
commit 3fd57d9c968395bd1178d2222e80eb76cbc9d2b8
Author: Henry Castro <hcastro at collabora.com>
Date: Sun Sep 27 17:39:25 2015 -0400
loolwsd: open reader FIFO to read messages from client
diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index f120ff6..aaeede4 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -57,11 +57,13 @@ using Poco::Process;
using Poco::Thread;
using Poco::ProcessHandle;
+const std::string FIFO_FILE = "/tmp/loolwsdfifo";
const std::string FIFO_BROKER = "/tmp/loolbroker.fifo";
const std::string BROKER_SUFIX = ".fifo";
const std::string BROKER_PREFIX = "/tmp/lokit";
static int readerChild = -1;
+static int readerBroker = -1;
static unsigned int childCounter = 0;
@@ -376,38 +378,43 @@ int main(int argc, char** argv)
if (loSubPath.empty())
{
std::cout << Util::logPrefix() << "--losubpath is empty" << std::endl;
- exit(1);
+ exit(-1);
}
if (sysTemplate.empty())
{
std::cout << Util::logPrefix() << "--systemplate is empty" << std::endl;
- exit(1);
+ exit(-1);
}
if (loTemplate.empty())
{
std::cout << Util::logPrefix() << "--lotemplate is empty" << std::endl;
- exit(1);
+ exit(-1);
}
if (childRoot.empty())
{
std::cout << Util::logPrefix() << "--childroot is empty" << std::endl;
- exit(1);
+ exit(-1);
}
if ( !_numPreSpawnedChildren )
{
std::cout << Util::logPrefix() << "--numprespawns is 0" << std::endl;
- exit(1);
+ exit(-1);
+ }
+
+ if ( (readerBroker = open(FIFO_FILE.c_str(), O_RDONLY) ) < 0 )
+ {
+ std::cout << Util::logPrefix() << "pipe error: " << strerror(errno) << std::endl;
+ exit(-1);
}
std::unique_lock<std::mutex> rngLock(_rngMutex);
Poco::UInt64 _childId = (((Poco::UInt64)_rng.next()) << 32) | _rng.next() | 1;
rngLock.unlock();
-
Path jail = Path::forDirectory(childRoot + Path::separator() + std::to_string(_childId));
File(jail).createDirectories();
@@ -424,7 +431,7 @@ int main(int argc, char** argv)
if (!File("loolkit").exists())
{
std::cout << Util::logPrefix() << "loolkit does not exists" << std::endl;
- exit(1);
+ exit(-1);
}
File("loolkit").copyTo(Path(jail, "/usr/bin").toString());
More information about the Libreoffice-commits
mailing list