fixed MMapFile on POSIX, again

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3642 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-08-27 08:29:02 +00:00
parent 3d4f901e5b
commit ff8e9a7662

View file

@ -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)