diff options
author | Carsten Driesner <cd@openoffice.org> | 2010-01-05 10:09:04 +0000 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2010-01-05 10:09:04 +0000 |
commit | 32e22775479b2aa36bade34f60201589b5954430 (patch) | |
tree | 00f205b80f02d298711774894b4237946fb23d5f | |
parent | 3bea77ef4e7ef1a5f0ed58128d536554330f1dd3 (diff) |
#i108012# Check for file size must be done earlier
-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 29edab385..034cf0b9a 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; } + /* HACK: because memory mapping fails on various + platforms if the size of the source file is 0 byte */ + if (0 == nSourceSize) + { + close(SourceFileFD); + close(DestFileFD); + return 0; + } + // read and lseek are used to check the possibility to access the data // not a nice solution, but it allows to avoid a crash in case it is an opened samba file // generally, reading of one byte should not affect the performance @@ -1034,15 +1043,6 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD return nRet; } - /* HACK: because memory mapping fails on various - platforms if the size of the source file is 0 byte */ - if (0 == nSourceSize) - { - close(SourceFileFD); - close(DestFileFD); - return 0; - } - size_t nWritten = 0; size_t nRemains = nSourceSize; |