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

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 24 14:40:32 UTC 2020


 kit/Kit.cpp |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit ce03253e52f779ab409eb658bd5cd12a7dccec85
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Apr 11 14:45:03 2020 -0400
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Fri Apr 24 16:40:14 2020 +0200

    wsd: linkOrCopy now uses realpath to avoid links
    
    This is needed in case the original template
    directory itself is linked, which after setting
    the FTW_PHYS flag to nftw skips them.
    
    Change-Id: I63141b64ca486e6e2e979cdf1d80fe0fd0f3990c
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92104
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index ff4663d44..ad37d3a2e 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -343,10 +343,19 @@ namespace
         return FTW_CONTINUE;
     }
 
-    void linkOrCopy(const std::string& source,
+    void linkOrCopy(std::string source,
                     const Path& destination,
                     LinkOrCopyType type)
     {
+        char* resolved = realpath(source.c_str(), nullptr);
+        if (resolved && resolved != source)
+        {
+            LOG_DBG("linkOrCopy: Using real path [" << resolved << "] instead of original link ["
+                                                    << source << "].");
+            source = resolved;
+            free(resolved);
+        }
+
         LOG_INF("linkOrCopy " << linkOrCopyTypeString(type) << " from [" << source << "] to ["
                               << destination.toString() << "].");
 


More information about the Libreoffice-commits mailing list