summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMikhail Voitenko <mav@openoffice.org>2010-01-22 08:25:03 +0000
committerMikhail Voitenko <mav@openoffice.org>2010-01-22 08:25:03 +0000
commitf97686f0876e965d0e600c1d29758c21057dffe4 (patch)
treec9e481109fb3d7f99428a9f9b640e42e3413360b /sal
parenta2cadf4bc167c9a5ad534af03f7960c6ef477c05 (diff)
#i108559# copy empty file correctly
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file_misc.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 0bde1616f6ae..b1a3f39ddf81 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -1013,6 +1013,15 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
return nRet;
}
+ DestFileFD=open(pszDestFileName, O_WRONLY | O_CREAT, mode);
+
+ if ( DestFileFD < 0 )
+ {
+ nRet=errno;
+ close(SourceFileFD);
+ return nRet;
+ }
+
/* HACK: because memory mapping fails on various
platforms if the size of the source file is 0 byte */
if (0 == nSourceSize)
@@ -1034,15 +1043,6 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
return nRet;
}
- DestFileFD=open(pszDestFileName, O_WRONLY | O_CREAT, mode);
-
- if ( DestFileFD < 0 )
- {
- nRet=errno;
- close(SourceFileFD);
- return nRet;
- }
-
size_t nWritten = 0;
size_t nRemains = nSourceSize;