summaryrefslogtreecommitdiff
path: root/sal/osl/unx/file_misc.cxx
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-10-15 20:34:28 +0300
committerTor Lillqvist <tml@collabora.com>2018-10-16 19:54:13 +0200
commit872f363a5926c76ed8b21dc209352cebfe955764 (patch)
tree646c617c8a4339fb06ee7458405d9536e14c7828 /sal/osl/unx/file_misc.cxx
parent5d0c83fd4cf91083805f60f49e4fafd3d6ac73d4 (diff)
Avoid risk of looking at an errno modified by SAL_INFO() call
Thanks to Stephan for noticing. Change-Id: I6b90258bdc6bce7b2aeb44f9a1a136b4b9bd51c9 Reviewed-on: https://gerrit.libreoffice.org/61812 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sal/osl/unx/file_misc.cxx')
-rw-r--r--sal/osl/unx/file_misc.cxx6
1 files changed, 4 insertions, 2 deletions
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;
}