diff options
-rw-r--r-- | sal/osl/unx/file.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index d3f6251b629b..008c61e67f2c 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -911,6 +911,18 @@ SAL_CALL osl_openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_u /* open the file */ int fd = open( cpFilePath, flags, mode ); +#ifdef IOS + /* Horrible hack: If opening for RDWR and getting EPERM, just try + * again for RDONLY. Quicker this way than to figure out why + * we get that oh so useful General Error when trying to open a + * read-only document. + */ + if (-1 == fd && (flags & O_RDWR) && EPERM == errno) + { + int rdonly_flags = (flags & ~O_ACCMODE) | O_RDONLY; + fd = open( cpFilePath, rdonly_flags, mode ); + } +#endif if (-1 == fd) { int saved_errno = errno; |