summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-10-11 15:32:26 +0300
committerTor Lillqvist <tml@collabora.com>2018-10-11 17:06:15 +0300
commit5f438ebe0824f04d08ddf2b39d7f5e02325f2ce3 (patch)
tree75492e3a2ddf5b897a68f7c84386b10b4b1b6882 /sal
parent5521184be8873552879f1118af529e3a9cac83ba (diff)
Tweak check for nonexistent file on iOS
Calling stat() on a non-existent file outside the sandbox fails with EPERM on iOS, not ENOENT. (Presumably calling stat() even on an existing file, but one you don't have been granted access to, also fails, because that is after all a point of sandboxing, you shouldn't even be allowed to figure out whether arbitrary files exist outside the sandbox.) Not sure why this change hasn't been necessary also for a sandboxed LibreOffice on macOS. Change-Id: I67c768e9c34fd17fa35f08232284210ff4a71b98
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file_misc.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index d44abb3f1c3c..2bc713dfd9c6 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -762,6 +762,14 @@ static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* p
{
nRet=errno;
+#ifdef IOS
+ // Checking for nonexistent files at least in the iCloud cache directory (like
+ // "/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/helloodt0.odt" fails
+ // with EPERM, not ENOENT.
+ if (nRet == EPERM)
+ DestFileExists=0;
+#endif
+
if (nRet == ENOENT)
DestFileExists=0;
}