loolwsd/LOOLKit.cpp | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-)
New commits: commit bad8ae9ed99879dbdac6cb37d425c922ba047d5b Author: Ashod Nakashian <[email protected]> Date: Sat Sep 17 09:18:33 2016 -0400 loolwsd: one anonymous namespace per file is enough Change-Id: I12b4967a321de45fc50ad314775d01499b5edd80 Reviewed-on: https://gerrit.libreoffice.org/29061 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp index d5d3fc9..252cfb3 100644 --- a/loolwsd/LOOLKit.cpp +++ b/loolwsd/LOOLKit.cpp @@ -231,6 +231,24 @@ namespace cap_free(caps); } + void symlinkPathToJail(const Path& jailPath, const std::string &loTemplate, + const std::string &loSubPath) + { + Path symlinkSource(jailPath, Path(loTemplate.substr(1))); + File(symlinkSource.parent()).createDirectories(); + + std::string symlinkTarget; + for (auto i = 0; i < Path(loTemplate).depth(); i++) + symlinkTarget += "../"; + symlinkTarget += loSubPath; + + Log::debug("symlink(\"" + symlinkTarget + "\",\"" + symlinkSource.toString() + "\")"); + if (symlink(symlinkTarget.c_str(), symlinkSource.toString().c_str()) == -1) + { + Log::syserror("symlink(\"" + symlinkTarget + "\",\"" + symlinkSource.toString() + "\") failed"); + throw Exception("symlink() failed"); + } + } } /// Connection thread with a client (via WSD). @@ -1292,27 +1310,6 @@ private: std::atomic_size_t _clientViews; }; -namespace { - void symlinkPathToJail(const Path& jailPath, const std::string &loTemplate, - const std::string &loSubPath) - { - Path symlinkSource(jailPath, Path(loTemplate.substr(1))); - File(symlinkSource.parent()).createDirectories(); - - std::string symlinkTarget; - for (auto i = 0; i < Path(loTemplate).depth(); i++) - symlinkTarget += "../"; - symlinkTarget += loSubPath; - - Log::debug("symlink(\"" + symlinkTarget + "\",\"" + symlinkSource.toString() + "\")"); - if (symlink(symlinkTarget.c_str(), symlinkSource.toString().c_str()) == -1) - { - Log::syserror("symlink(\"" + symlinkTarget + "\",\"" + symlinkSource.toString() + "\") failed"); - throw Exception("symlink() failed"); - } - } -} - void lokit_main(const std::string& childRoot, const std::string& sysTemplate, const std::string& loTemplate, _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
