[Libreoffice-commits] online.git: Branch 'private/hcvcastro/forking' - loolwsd/LOOLBroker.cpp loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp

Henry Castro hcastro at collabora.com
Fri Jul 24 14:39:09 PDT 2015


 loolwsd/LOOLBroker.cpp |   28 ++++++++++++++--------------
 loolwsd/LOOLKit.cpp    |    4 ++--
 loolwsd/LOOLWSD.cpp    |    2 +-
 3 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 4f9ded0d0bd91b8ea67ce7673937fa36860c003f
Author: Henry Castro <hcastro at collabora.com>
Date:   Fri Jul 24 17:36:57 2015 -0400

    loolwsd: add logPrefix()

diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index 844b40f..4145d7a 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -146,12 +146,12 @@ namespace
 
         if (cap_set_proc(caps) == -1)
         {
-            std::cout << std::string("cap_set_proc() failed: ") + strerror(errno) << std::endl;
+            std::cout << Util::logPrefix() << std::string("cap_set_proc() failed: ") + strerror(errno) << std::endl;
             exit(1);
         }
 
         char *capText = cap_to_text(caps, NULL);
-        std::cout <<Util::logPrefix() + "Capabilities now: " + capText << std::endl;
+        std::cout << Util::logPrefix() + "Capabilities now: " + capText << std::endl;
         cap_free(capText);
 
         cap_free(caps);
@@ -164,7 +164,7 @@ namespace
             // needs to run on non-Linux Unixes, setuid root is what it will bneed to be to be able
             // to do chroot().
             if (setuid(getuid()) != 0) {
-                std::cout << std::string("setuid() failed: ") + strerror(errno) << std::endl;
+                std::cout << Util::logPrefix() << std::string("setuid() failed: ") + strerror(errno) << std::endl;
             }
         }
 #if ENABLE_DEBUG
@@ -187,7 +187,7 @@ namespace
                     LOOLWSD::uid = 65534;
             }
             if (setuid(LOOLWSD::uid) != 0) {
-                std::cout << std::string("setuid() failed: ") + strerror(errno) << std::endl;
+                std::cout << Util::logPrefix() << std::string("setuid() failed: ") + strerror(errno) << std::endl;
             }
         }
 #endif
@@ -292,31 +292,31 @@ int main(int argc, char** argv)
    
    if (loSubPath.empty())
    {
-     std::cout << "--losubpath is empty" << std::endl;
+     std::cout << Util::logPrefix() << "--losubpath is empty" << std::endl;
      exit(1);
    }
     
    if (sysTemplate.empty())
    {
-     std::cout << "--systemplate is empty" << std::endl;
+     std::cout << Util::logPrefix() << "--systemplate is empty" << std::endl;
      exit(1);
    }
 
    if (loTemplate.empty())
    {
-     std::cout << "--lotemplate is empty" << std::endl;
+     std::cout << Util::logPrefix() << "--lotemplate is empty" << std::endl;
      exit(1);
    }
 
    if (childRoot.empty())
    {
-     std::cout << "--childroot is empty" << std::endl;
+     std::cout << Util::logPrefix() << "--childroot is empty" << std::endl;
      exit(1);
    }
 
    if ( !_numPreSpawnedChildren )
    {
-     std::cout << "--numprespawns is 0" << std::endl;
+     std::cout << Util::logPrefix() << "--numprespawns is 0" << std::endl;
      exit(1);
    }
 
@@ -340,7 +340,7 @@ int main(int argc, char** argv)
     // It is necessary to deploy loolkit process to chroot jail.
     if (!File("loolkit").exists())
     {
-      std::cout << "loolkit does not exists" << std::endl;
+      std::cout << Util::logPrefix() << "loolkit does not exists" << std::endl;
       exit(1);
     }
     File("loolkit").copyTo(Path(jail, "/usr/bin").toString());
@@ -367,16 +367,16 @@ int main(int argc, char** argv)
     }
 #endif
 
-    std::cout << "loolbroker -> chroot(\"" + jail.toString() + "\")" << std::endl;
+    std::cout << Util::logPrefix() << "loolbroker -> chroot(\"" + jail.toString() + "\")" << std::endl;
     if (chroot(jail.toString().c_str()) == -1)
     {
-        std::cout << "chroot(\"" + jail.toString() + "\") failed: " + strerror(errno) << std::endl;
+        std::cout << Util::logPrefix() << "chroot(\"" + jail.toString() + "\") failed: " + strerror(errno) << std::endl;
         exit(-1);
     }
 
     if (chdir("/") == -1)
     {
-        std::cout << std::string("chdir(\"/\") in jail failed: ") + strerror(errno) << std::endl;
+        std::cout << Util::logPrefix() << std::string("chdir(\"/\") in jail failed: ") + strerror(errno) << std::endl;
         exit(-1);
     }
 
@@ -388,7 +388,7 @@ int main(int argc, char** argv)
 
     if (std::getenv("SLEEPFORDEBUGGER"))
     {
-        std::cout << "Sleeping " << std::getenv("SLEEPFORDEBUGGER") << " seconds, " <<
+        std::cout << Util::logPrefix() <<  "Sleeping " << std::getenv("SLEEPFORDEBUGGER") << " seconds, " <<
             "attach process " << Process::id() << " in debugger now." << std::endl;
         Thread::sleep(std::stoul(std::getenv("SLEEPFORDEBUGGER")) * 1000);
     }
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index eca6c8c..ab2b812 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -104,13 +104,13 @@ int main(int argc, char** argv)
 
    if (loSubPath.empty())
    {
-     std::cout << "--losubpath is empty" << std::endl;
+     std::cout << Util::logPrefix() << "--losubpath is empty" << std::endl;
      exit(1);
    }
 
    if ( !_childId )
    {
-     std::cout << "--child is 0" << std::endl;
+     std::cout << Util::logPrefix() << "--child is 0" << std::endl;
      exit(1);
    }
 
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 06efc10..7c0bb02 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -591,7 +591,7 @@ int LOOLWSD::main(const std::vector<std::string>& args)
 {
     if (access(cache.c_str(), R_OK | W_OK | X_OK) != 0)
     {
-        std::cout << "Unable to access " << cache <<
+        std::cout << Util::logPrefix() << "Unable to access " << cache <<
             ", please make sure it exists, and has write permission for this user." << std::endl;
         return Application::EXIT_UNAVAILABLE;
     }


More information about the Libreoffice-commits mailing list