diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-10-12 03:06:27 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-10-12 08:56:20 +0200 |
commit | f8c77cf7ebaf63e3aac85269c637c92a37bc988b (patch) | |
tree | b61fdb424f506b7aa7d98a43cf96ccdf0bc3d3aa /sal/osl/unx/profile.cxx | |
parent | fa394eef4017d62549599ded3a62d790bc508582 (diff) |
More SAL_INFO("sal.file", ...) tweaks
Change-Id: I999d641b54a53c5a737e82d67a0a1ffa769afd24
Reviewed-on: https://gerrit.libreoffice.org/61700
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sal/osl/unx/profile.cxx')
-rw-r--r-- | sal/osl/unx/profile.cxx | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx index 4bd77901b247..6af40898a58c 100644 --- a/sal/osl/unx/profile.cxx +++ b/sal/osl/unx/profile.cxx @@ -949,6 +949,15 @@ static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption Pro if (! bWriteable) { pFile->m_Handle = open(pszFilename, O_RDONLY); + + if (pFile->m_Handle == -1) + { + int e = errno; + SAL_INFO("sal.file", "open(" << pszFilename << ",O_RDONLY): errno " << e << ": " << strerror(e)); + } + else + SAL_INFO("sal.file", "open(" << pszFilename << ",O_RDONLY) => " << pFile->m_Handle); + /* mfe: argghh!!! do not check if the file could be opened */ /* default mode expects it that way!!! */ } @@ -957,9 +966,13 @@ static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption Pro if (((pFile->m_Handle = open(pszFilename, O_RDWR | O_CREAT | O_EXCL, DEFAULT_PMODE)) < 0) && ((pFile->m_Handle = open(pszFilename, O_RDWR)) < 0)) { + int e = errno; + SAL_INFO("sal.file", "open(" << pszFilename << ",...): errno " << e << ": " << strerror(e)); free(pFile); return nullptr; } + else + SAL_INFO("sal.file", "open(" << pszFilename << ",...) => " << pFile->m_Handle); } /* set close-on-exec flag */ @@ -1003,6 +1016,7 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile, oslProfileOption Flags) } close(pFile->m_Handle); + SAL_INFO("sal.file", "close(" << pFile->m_Handle << ")"); pFile->m_Handle = -1; } @@ -1710,8 +1724,27 @@ static bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) unlink( pszBakFile ); // Rename ini -> bak, then tmp -> ini: - return rename( pProfile->m_FileName, pszBakFile ) == 0 - && rename( pszTmpFile, pProfile->m_FileName ) == 0; + bool result = rename( pProfile->m_FileName, pszBakFile ) == 0; + if (!result) + { + int e = errno; + SAL_INFO("sal.file", "rename(" << pProfile->m_FileName << "," << pszBakFile << "): errno " << e << ": " << strerror(e)); + } + else + { + SAL_INFO("sal.file", "rename(" << pProfile->m_FileName << "," << pszBakFile << "): OK"); + result = rename( pszTmpFile, pProfile->m_FileName ) == 0; + if (!result) + { + int e = errno; + SAL_INFO("sal.file", "rename(" << pszTmpFile << "," << pProfile->m_FileName << "): errno " << e << ": " << strerror(e)); + } + else + { + SAL_INFO("sal.file", "rename(" << pszTmpFile << "," << pProfile->m_FileName << "): OK"); + } + } + return result; } static void osl_ProfileGenerateExtension(const sal_Char* pszFileName, const sal_Char* pszExtension, sal_Char* pszTmpName, int BufferMaxLen) |