[Libreoffice-commits] online.git: kit/Kit.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 16 06:28:04 UTC 2017


 kit/Kit.cpp |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 6246e744334c1df4fa524cefaabdcb5d0880c26a
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Jan 15 23:54:08 2017 -0500

    wsd: copy jail files when symlinking fails
    
    Change-Id: I1f56d1489820a0689495e09151101d41a2322b82
    Reviewed-on: https://gerrit.libreoffice.org/33143
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index b82cdc8..ba5f5b6 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -146,9 +146,18 @@ namespace
             File(newPath.parent()).createDirectories();
             if (link(fpath, newPath.toString().c_str()) == -1)
             {
-                LOG_SYS("link(\"" << std::string(fpath) << "\",\"" <<
-                        newPath.toString() << "\") failed. Exiting.");
-                std::_Exit(Application::EXIT_SOFTWARE);
+                LOG_SYS("link(\"" << fpath << "\", \"" <<
+                        newPath.toString() << "\") failed. Will copy.");
+                try
+                {
+                    File(fpath).copyTo(newPath.toString());
+                }
+                catch (const std::exception& exc)
+                {
+                    LOG_ERR("Copying of '" << fpath << "' to " << newPath.toString() <<
+                            " failed: " << exc.what() << ". Exiting.");
+                    std::_Exit(Application::EXIT_SOFTWARE);
+                }
             }
             break;
         case FTW_D:
@@ -199,7 +208,9 @@ namespace
             sourceForLinkOrCopy.pop_back();
         destinationForLinkOrCopy = destination;
         if (nftw(source.c_str(), linkOrCopyFunction, 10, FTW_ACTIONRETVAL) == -1)
+        {
             LOG_ERR("linkOrCopy: nftw() failed for '" << source << "'");
+        }
     }
 
     void dropCapability(cap_value_t capability)


More information about the Libreoffice-commits mailing list