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

Add more SAL_INFO("sal.file", ...) calls to trace actual file operations

As we already do SAL_INFO logging for some low-level file operations,
surely we should try to do it for all such operations.

Change-Id: I252bbb2149c1dc7aaeaa9ea15674e1f87547f249
Reviewed-on: https://gerrit.libreoffice.org/61659Reviewed-by: 's avatarTor Lillqvist <tml@collabora.com>
Tested-by: 's avatarTor Lillqvist <tml@collabora.com>
üst bf0276f0
...@@ -697,8 +697,11 @@ static oslFileError osl_unlinkFile(const sal_Char* pszPath) ...@@ -697,8 +697,11 @@ static oslFileError osl_unlinkFile(const sal_Char* pszPath)
if (nRet < 0) if (nRet < 0)
{ {
nRet=errno; nRet=errno;
SAL_INFO("sal.file", "unlink(" << pszPath << "): errno " << nRet << ": " << strerror(nRet));
return oslTranslateFileError(nRet); return oslTranslateFileError(nRet);
} }
else
SAL_INFO("sal.file", "unlink(" << pszPath << "): OK");
return osl_File_E_None; return osl_File_E_None;
} }
...@@ -712,8 +715,11 @@ static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* ps ...@@ -712,8 +715,11 @@ static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* ps
if (nRet < 0) if (nRet < 0)
{ {
nRet=errno; nRet=errno;
SAL_INFO("sal.file", "rename(" << pszPath << "," << pszDestPath << "): errno " << nRet << ": " << strerror(nRet));
return oslTranslateFileError(nRet); return oslTranslateFileError(nRet);
} }
else
SAL_INFO("sal.file", "rename(" << pszPath << "," << pszDestPath << "): OK");
return osl_File_E_None; return osl_File_E_None;
} }
...@@ -796,13 +802,16 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char* ...@@ -796,13 +802,16 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
else else
{ {
int e = errno; int e = errno;
SAL_INFO( SAL_INFO("sal.file", "rename(" << pszDestFileName << ", " << tmpDestFile
"sal.osl", << "): errno " << e << ": " << strerror(e));
"rename(" << pszDestFileName << ", " << tmpDestFile
<< ") failed with errno " << e);
return osl_File_E_EXIST; // for want of a better error code return osl_File_E_EXIST; // for want of a better error code
} }
} }
else
{
SAL_INFO("sal.file", "rename(" << pszDestFileName << ", " << tmpDestFile
<< "): OK");
}
} }
/* mfe: should be S_ISREG */ /* mfe: should be S_ISREG */
...@@ -824,15 +833,22 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char* ...@@ -824,15 +833,22 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
if ( nRet > 0 && DestFileExists == 1 ) if ( nRet > 0 && DestFileExists == 1 )
{ {
unlink(pszDestFileName); if (unlink(pszDestFileName) != 0)
{
int e = errno;
SAL_INFO("sal.file", "unlink(" << pszDestFileName << "): errno " << e << ": " << strerror(e));
}
else
SAL_INFO("sal.file", "unlink(" << pszDestFileName << "): OK");
if (rename(tmpDestFile.getStr(), pszDestFileName) != 0) if (rename(tmpDestFile.getStr(), pszDestFileName) != 0)
{ {
int e = errno; int e = errno;
SAL_WARN( SAL_INFO("sal.file", "rename(" << tmpDestFile << ", " << pszDestFileName
"sal.osl", << "): errno " << e << ": " << strerror(e));
"rename(" << tmpDestFile << ", " << pszDestFileName
<< ") failed with errno " << e);
} }
else
SAL_INFO("sal.file", "rename(" << tmpDestFile << ", " << pszDestFileName << "): OK");
} }
if ( nRet > 0 ) if ( nRet > 0 )
...@@ -859,9 +875,10 @@ void attemptChangeMetadata( const sal_Char* pszFileName, mode_t nMode, time_t nA ...@@ -859,9 +875,10 @@ void attemptChangeMetadata( const sal_Char* pszFileName, mode_t nMode, time_t nA
#endif #endif
{ {
int e = errno; int e = errno;
SAL_INFO( SAL_INFO("sal.file", "chmod(" << pszFileName << std::oct << nMode << std::dec <<"): errno " << e << ": " << strerror(e));
"sal.osl", "chmod(" << pszFileName << ") failed with errno " << e);
} }
else
SAL_INFO("sal.file", "chmod(" << pszFileName << std::oct << nMode << std::dec <<"): OK");
// No way to change utime of a symlink itself: // No way to change utime of a symlink itself:
if (!S_ISLNK(nMode)) if (!S_ISLNK(nMode))
...@@ -871,9 +888,7 @@ void attemptChangeMetadata( const sal_Char* pszFileName, mode_t nMode, time_t nA ...@@ -871,9 +888,7 @@ void attemptChangeMetadata( const sal_Char* pszFileName, mode_t nMode, time_t nA
if ( utime(pszFileName,&aTimeBuffer) < 0 ) if ( utime(pszFileName,&aTimeBuffer) < 0 )
{ {
int e = errno; int e = errno;
SAL_INFO( SAL_INFO("sal.file", "utime(" << pszFileName << "): errno " << e);
"sal.osl",
"utime(" << pszFileName << ") failed with errno " << e);
} }
} }
...@@ -884,9 +899,10 @@ void attemptChangeMetadata( const sal_Char* pszFileName, mode_t nMode, time_t nA ...@@ -884,9 +899,10 @@ void attemptChangeMetadata( const sal_Char* pszFileName, mode_t nMode, time_t nA
if ( lchown(pszFileName,nUID,nGID) < 0 ) if ( lchown(pszFileName,nUID,nGID) < 0 )
{ {
int e = errno; int e = errno;
SAL_INFO( SAL_INFO("sal.file", "lchown(" << pszFileName << "): errno " << e);
"sal.osl", "lchown(" << pszFileName << ") failed with errno " << e);
} }
else
SAL_INFO("sal.file", "lchown(" << pszFileName << "): OK");
} }
static int oslDoCopyLink(const sal_Char* pszSourceFileName, const sal_Char* pszDestFileName) static int oslDoCopyLink(const sal_Char* pszSourceFileName, const sal_Char* pszDestFileName)
......
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