From 72be5ac08aa963bdd42d2e56a62f43e69f728caa Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 3 Sep 2018 21:07:00 +0200 Subject: tdf#119381 sfx2 store: don't break symlink targets osl::File::move() would not follow symlinks for the target, so don't move the file in that case. Change-Id: I907e1ba8db04dad670c884ea0283947f953117da Reviewed-on: https://gerrit.libreoffice.org/59949 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sfx2/qa/cppunit/test_misc.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sfx2/qa') diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx index fa3a2c1bca6d..83c4c8db77f7 100644 --- a/sfx2/qa/cppunit/test_misc.cxx +++ b/sfx2/qa/cppunit/test_misc.cxx @@ -186,6 +186,15 @@ void MiscTest::testHardLinks() // This failed: hard link count was 1, the hard link broke on store. CPPUNIT_ASSERT(buf.st_nlink > 1); + // Test that symlinks are presreved as well. + remove(aNew.getStr()); + symlink(aOld.getStr(), aNew.getStr()); + xStorable->storeToURL(aURL + ".2", {}); + nRet = lstat(aNew.getStr(), &buf); + CPPUNIT_ASSERT_EQUAL(0, nRet); + // This failed, the hello.odt.2 symlink was replaced with a real file. + CPPUNIT_ASSERT(bool(S_ISLNK(buf.st_mode))); + xComponent->dispose(); #endif } -- cgit