From ff8e9a7662830cb3cfc64b44c465e4b4303eddc1 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 27 Aug 2004 08:29:02 +0000 Subject: [PATCH] fixed MMapFile on POSIX, again git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3642 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/strlist.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Source/strlist.h b/Source/strlist.h index b887d69f..26a58523 100644 --- a/Source/strlist.h +++ b/Source/strlist.h @@ -635,15 +635,18 @@ class MMapFile : public IMMap m_hFileDesc = fileno(m_hFile); m_bTempHandle = TRUE; } + } - // resize - if (m_hFileDesc != -1) + // resize + if (m_hFileDesc != -1) + { + unsigned char c = 0; + + if (lseek(m_hFileDesc, m_iSize, SEEK_SET) != (off_t)-1) { - char c; - - if (lseek(m_hFileDesc, m_iSize, SEEK_SET) != (off_t)-1) + if (read(m_hFileDesc, &c, 1) != -1) { - if (read(m_hFileDesc, &c, 1) != -1) + if (lseek(m_hFileDesc, m_iSize, SEEK_SET) != (off_t)-1) { if (write(m_hFileDesc, &c, 1) != -1) { @@ -652,9 +655,9 @@ class MMapFile : public IMMap } } } - - m_hFileDesc = -1; // some error occured, bail } + + m_hFileDesc = -1; // some error occured, bail #endif #ifdef _WIN32 @@ -734,11 +737,7 @@ class MMapFile : public IMMap quit(); } -#ifdef _WIN32 return (void *)((char *)m_pView + offset - alignedoffset); -#else - return m_pView; -#endif } void *getmore(int offset, int *size)