Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
30c9034c
Kaydet (Commit)
30c9034c
authored
Eki 31, 2014
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Simplify by using OString
Change-Id: Ia46417525e655a5a80f9e70f25f65e4916e4c8d8
üst
292256d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
file_misc.cxx
sal/osl/unx/file_misc.cxx
+7
-21
No files found.
sal/osl/unx/file_misc.cxx
Dosyayı görüntüle @
30c9034c
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "osl/thread.h"
#include "osl/thread.h"
#include <osl/signal.h>
#include <osl/signal.h>
#include "rtl/alloc.h"
#include "rtl/alloc.h"
#include <rtl/string.hxx>
#include "system.h"
#include "system.h"
#include "file_impl.hxx"
#include "file_impl.hxx"
...
@@ -795,31 +796,16 @@ static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* p
...
@@ -795,31 +796,16 @@ static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* p
return
tErr
;
return
tErr
;
}
}
#define TMP_DEST_FILE_EXTENSION ".osl-tmp"
static
oslFileError
oslDoCopy
(
const
sal_Char
*
pszSourceFileName
,
const
sal_Char
*
pszDestFileName
,
mode_t
nMode
,
size_t
nSourceSize
,
int
DestFileExists
)
static
oslFileError
oslDoCopy
(
const
sal_Char
*
pszSourceFileName
,
const
sal_Char
*
pszDestFileName
,
mode_t
nMode
,
size_t
nSourceSize
,
int
DestFileExists
)
{
{
int
nRet
=
0
;
int
nRet
=
0
;
sal_Char
pszTmpDestFile
[
PATH_MAX
];
size_t
size_tmp_dest_buff
=
sizeof
(
pszTmpDestFile
);
/* Quick fix for #106048, the whole copy file function seems
to be erroneous anyway and needs to be rewritten.
*/
memset
(
pszTmpDestFile
,
0
,
size_tmp_dest_buff
);
rtl
::
OString
tmpDestFile
;
if
(
DestFileExists
)
if
(
DestFileExists
)
{
{
//TODO: better pick a temp file name instead of adding .osl-tmp:
//TODO: better pick a temp file name instead of adding .osl-tmp:
tmpDestFile
=
rtl
::
OString
(
pszSourceFileName
)
+
".osl-tmp"
;
strncpy
(
pszTmpDestFile
,
pszDestFileName
,
size_tmp_dest_buff
-
1
);
if
(
rename
(
pszDestFileName
,
tmpDestFile
.
getStr
())
!=
0
)
if
((
strlen
(
pszTmpDestFile
)
+
strlen
(
TMP_DEST_FILE_EXTENSION
))
>=
size_tmp_dest_buff
)
return
osl_File_E_NAMETOOLONG
;
strncat
(
pszTmpDestFile
,
TMP_DEST_FILE_EXTENSION
,
strlen
(
TMP_DEST_FILE_EXTENSION
));
if
(
rename
(
pszDestFileName
,
pszTmpDestFile
)
!=
0
)
{
{
if
(
errno
==
ENOENT
)
if
(
errno
==
ENOENT
)
{
{
...
@@ -830,7 +816,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
...
@@ -830,7 +816,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
int
e
=
errno
;
int
e
=
errno
;
SAL_INFO
(
SAL_INFO
(
"sal.osl"
,
"sal.osl"
,
"rename("
<<
pszDestFileName
<<
", "
<<
pszT
mpDestFile
"rename("
<<
pszDestFileName
<<
", "
<<
t
mpDestFile
<<
") failed with errno "
<<
e
);
<<
") failed with errno "
<<
e
);
return
osl_File_E_BUSY
;
// for want of a better error code
return
osl_File_E_BUSY
;
// for want of a better error code
}
}
...
@@ -857,7 +843,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
...
@@ -857,7 +843,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
if
(
nRet
>
0
&&
DestFileExists
==
1
)
if
(
nRet
>
0
&&
DestFileExists
==
1
)
{
{
unlink
(
pszDestFileName
);
unlink
(
pszDestFileName
);
rename
(
pszTmpDestFile
,
pszDestFileName
);
rename
(
tmpDestFile
.
getStr
(),
pszDestFileName
);
}
}
if
(
nRet
>
0
)
if
(
nRet
>
0
)
...
@@ -867,7 +853,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
...
@@ -867,7 +853,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
if
(
DestFileExists
==
1
)
if
(
DestFileExists
==
1
)
{
{
unlink
(
pszTmpDestFile
);
unlink
(
tmpDestFile
.
getStr
()
);
}
}
return
osl_File_E_None
;
return
osl_File_E_None
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment