From e3fe5d8af98e71212a5f4a996c36e25bb2893857 Mon Sep 17 00:00:00 2001 From: zhaolei <353719554@qq.com> Date: Sun, 17 May 2026 11:32:22 +0800 Subject: [PATCH] =?UTF-8?q?linux=E7=BC=96=E8=AF=91=E4=B8=8D=E8=BF=87?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Slfio/src/slf.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Slfio/src/slf.cpp b/Slfio/src/slf.cpp index 21f6772..dfe78f7 100644 --- a/Slfio/src/slf.cpp +++ b/Slfio/src/slf.cpp @@ -113,12 +113,10 @@ bool MappingMem(HANDLE *hHandle,LPSTR *hMem,int len,const char* name) 0, // low offset: beginning 0); // default: map entire file #else - HANDLE hMapFile = open(slf1.toStdString().c_str(),O_RDONLY)); - if((hMapFile < 0) - { - return false; - } - *hMem = (LPSTR)mmap(0,0,PROT_READ,MAP_SHARED,hMapFile,0)); + int hMapFile = open(slf1.toStdString().c_str(), O_RDONLY); + if (hMapFile<0) + return FALSE; + *hMem = (LPSTR )mmap(0, 0,PROT_READ,MAP_SHARED,hMapFile,0); #endif if (*hMem == NULL) return FALSE; return TRUE; @@ -130,7 +128,7 @@ void CloseView(HANDLE hMapObject,LPVOID lpvMem) if(lpvMem)UnmapViewOfFile(lpvMem); if(hMapObject)CloseHandle(hMapObject); #else - if(lpvMem)munmap(m_rbuf, m_mapsize); + if(lpvMem)munmap(lpvMem,0); if(hMapObject)close(hMapObject); return; #endif