summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/unx/file.cxx7
-rw-r--r--sal/osl/unx/file_misc.cxx6
2 files changed, 9 insertions, 4 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index c3c5cd7fd655..ae1bc31c9069 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -966,7 +966,10 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI
int e = errno;
SAL_INFO("sal.file", "flock(" << fd << ",LOCK_EX|LOCK_NB): errno " << e << ": " << strerror(e));
/* Mac OSX returns ENOTSUP for webdav drives. We should try read lock */
- if ((e != ENOTSUP) || ((flock(fd, LOCK_SH | LOCK_NB) == 1) && (errno != ENOTSUP)))
+
+ // Restore errno after possibly having been overwritten by the SAL_INFO above...
+ errno = e;
+ if ((errno != ENOTSUP) || ((flock(fd, LOCK_SH | LOCK_NB) == 1) && (errno != ENOTSUP)))
{
eRet = oslTranslateFileError(errno);
(void) close(fd);
@@ -1100,7 +1103,7 @@ oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle)
{
int e = errno;
SAL_INFO("sal.file", "fsync(" << pImpl->m_fd << "): errno " << e << ": " << strerror(e));
- return oslTranslateFileError(errno);
+ return oslTranslateFileError(e);
}
else
SAL_INFO("sal.file", "fsync(" << pImpl->m_fd << "): OK");
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 507779c7fe6c..a45d32e4c79e 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -218,6 +218,8 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect
{
int e = errno;
SAL_INFO("sal.file", "opendir(" << path << "): errno " << e << ": " << strerror(e));
+ // Restore errno after possible modification by SAL_INFO above
+ errno = e;
}
}
}
@@ -249,7 +251,7 @@ oslFileError SAL_CALL osl_closeDirectory(oslDirectory pDirectory)
{
int e = errno;
SAL_INFO("sal.file", "closedir(" << pDirImpl->pDirStruct << "): errno " << e << ": " << strerror(e));
- err = oslTranslateFileError(errno);
+ err = oslTranslateFileError(e);
}
else
SAL_INFO("sal.file", "closedir(" << pDirImpl->pDirStruct << "): OK");
@@ -819,7 +821,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
int e = errno;
SAL_INFO("sal.file", "rename(" << pszDestFileName << ", " << tmpDestFile
<< "): errno " << e << ": " << strerror(e));
- if (errno == ENOENT)
+ if (e == ENOENT)
{
DestFileExists = 0;
}