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 | cf95e01ac375206a63db7bd08c4ed3bbc430c093 (patch) | |
tree | 29cb32a4196f127d45bdf909509fc6418cc14aaf /sal/osl/unx/file_misc.cxx | |
parent | 6e8628fb7374b7d19e15f03e63f8ad221ca25f1e (diff) |
#i108012# Check for file size must be done earlier
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 b9b2b6a23c7d..0bde1616f6ae 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; |