[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed Apr 13 11:49:49 UTC 2016


 loolwsd/LOOLKit.cpp |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 65ee0a1cdd95b544028f18a30ded9aad92806d7b
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Apr 13 07:18:30 2016 -0400

    loolwsd: corrected etc file copying
    
    Change-Id: Ie920bbdee38d4b0a338753a6d483e274052939ce
    Reviewed-on: https://gerrit.libreoffice.org/24053
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index fe168e2..2b16af4 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -951,19 +951,20 @@ void lokit_main(const std::string& childRoot,
                    bLoopMounted ? COPY_NO_USR : COPY_ALL);
         linkOrCopy(loTemplate, jailLOInstallation, COPY_LO);
 
-        Log::debug("Initialized jail files.");
-
         // We need this because sometimes the hostname is not resolved
-        const std::vector<std::string> networkFiles = {"/etc/host.conf", "/etc/hosts", "/etc/nsswitch.conf", "/etc/resolv.conf"};
+        const auto networkFiles = {"/etc/host.conf", "/etc/hosts", "/etc/nsswitch.conf", "/etc/resolv.conf"};
         for (const auto& filename : networkFiles)
         {
+            const auto etcPath = Path(jailPath, filename).toString();
             const File networkFile(filename);
-            if (networkFile.exists())
+            if (networkFile.exists() && !File(etcPath).exists())
             {
-                networkFile.copyTo(Path(jailPath, "/etc").toString());
+                networkFile.copyTo(etcPath);
             }
         }
 
+        Log::debug("Initialized jail files.");
+
         // Create the urandom and random devices
         File(Path(jailPath, "/dev")).createDirectory();
         if (mknod((jailPath.toString() + "/dev/random").c_str(),


More information about the Libreoffice-commits mailing list