diff options
author | Mikhail Voitenko <mav@openoffice.org> | 2010-01-22 08:25:03 +0000 |
---|---|---|
committer | Mikhail Voitenko <mav@openoffice.org> | 2010-01-22 08:25:03 +0000 |
commit | f97686f0876e965d0e600c1d29758c21057dffe4 (patch) | |
tree | c9e481109fb3d7f99428a9f9b640e42e3413360b /sal/osl/unx/file_misc.cxx | |
parent | a2cadf4bc167c9a5ad534af03f7960c6ef477c05 (diff) |
#i108559# copy empty file correctly
Diffstat (limited to 'sal/osl/unx/file_misc.cxx')
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 18 |
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; |