diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-10-11 15:32:26 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2018-10-30 17:00:48 +0000 |
commit | dbff19b65a852b3ed73c2dff9d790d23abe2c621 (patch) | |
tree | 298d456494c0934ec1968174a96fc246defd1d47 /sal | |
parent | afb2a51dad3b30844dccde2b647c2927499bc104 (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
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 5f7bdc5b010b..da2b108ecce5 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. * @@ -758,6 +758,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; |