Kaydet (Commit) ebb4ac78 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

coverity#1190347 check rename(3) return value

Change-Id: Iebd3b0e1b52a01e14e01c6db1ca158ada91e8613
üst f52dbb2d
...@@ -130,7 +130,7 @@ static sal_Bool releaseProfile(osl_TProfileImpl* pProfile); ...@@ -130,7 +130,7 @@ static sal_Bool releaseProfile(osl_TProfileImpl* pProfile);
static sal_Bool writeProfileImpl (osl_TFile* pFile); static sal_Bool writeProfileImpl (osl_TFile* pFile);
static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl*); static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl*);
static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl*); static bool osl_ProfileSwapProfileNames(osl_TProfileImpl*);
static void osl_ProfileGenerateExtension(const sal_Char* pszFileName, const sal_Char* pszExtension, sal_Char* pszTmpName, int BufferMaxLen); static void osl_ProfileGenerateExtension(const sal_Char* pszFileName, const sal_Char* pszExtension, sal_Char* pszTmpName, int BufferMaxLen);
static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, oslProfileOption Flags); static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, oslProfileOption Flags);
...@@ -2014,10 +2014,8 @@ static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile) ...@@ -2014,10 +2014,8 @@ static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile)
return pFile; return pFile;
} }
static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) static bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
{ {
sal_Bool bRet = sal_False;
sal_Char pszBakFile[PATH_MAX]; sal_Char pszBakFile[PATH_MAX];
sal_Char pszTmpFile[PATH_MAX]; sal_Char pszTmpFile[PATH_MAX];
...@@ -2030,13 +2028,9 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) ...@@ -2030,13 +2028,9 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
/* unlink bak */ /* unlink bak */
unlink( pszBakFile ); unlink( pszBakFile );
/* rename ini bak */ // Rename ini -> bak, then tmp -> ini:
rename( pProfile->m_FileName, pszBakFile ); return rename( pProfile->m_FileName, pszBakFile ) == 0
&& rename( pszTmpFile, pProfile->m_FileName ) == 0;
/* rename tmp ini */
rename( pszTmpFile, pProfile->m_FileName );
return bRet;
} }
static void osl_ProfileGenerateExtension(const sal_Char* pszFileName, const sal_Char* pszExtension, sal_Char* pszTmpName, int BufferMaxLen) static void osl_ProfileGenerateExtension(const sal_Char* pszFileName, const sal_Char* pszExtension, sal_Char* pszTmpName, int BufferMaxLen)
......
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