Kaydet (Commit) bdbb0d1c authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Temporary hack for iOS: open files read-only if read-write open fails

Change-Id: Ifc400d9843b23ef942c43af3a2b8830ccff71a7e
üst 2672cbdd
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment