diff --git a/xpcom/ds/nsPageMgr.cpp b/xpcom/ds/nsPageMgr.cpp index 422750a373bc..87f3dcdfde22 100644 --- a/xpcom/ds/nsPageMgr.cpp +++ b/xpcom/ds/nsPageMgr.cpp @@ -366,16 +366,16 @@ nsPageMgr::InitPages(nsPageCount minPages, nsPageCount maxPages) nsPage* addr = NULL; nsPageCount size = maxPages; - int zero_fd; + mZero_fd == NULL; - zero_fd = open("/dev/zero", O_RDWR); + mZero_fd = open("/dev/zero", O_RDWR); while (addr == NULL) { /* let the system place the heap */ addr = (nsPage*)mmap(0, size << NS_PAGEMGR_PAGE_BITS, PROT_READ | PROT_WRITE, MAP_PRIVATE, - zero_fd, 0); + mZero_fd, 0); if (addr == (nsPage*)MAP_FAILED) { addr = NULL; size--; @@ -433,6 +433,7 @@ nsPageMgr::FinalizePages() #else munmap((caddr_t)mMemoryBase, mPageCount << NS_PAGEMGR_PAGE_BITS); + close(mZero_fd); #endif } diff --git a/xpcom/ds/nsPageMgr.h b/xpcom/ds/nsPageMgr.h index 0fa019871981..5eb5986486d9 100644 --- a/xpcom/ds/nsPageMgr.h +++ b/xpcom/ds/nsPageMgr.h @@ -191,6 +191,11 @@ class nsPageMgr : public nsIPageManager, public nsIAllocator { #if defined(XP_BEOS) area_id mAid; #endif + +#if (! defined(VMS)) && (! defined(XP_BEOS)) && (! defined(XP_MAC)) && (! defined(XP_PC)) + int mZero_fd; +#endif + }; /******************************************************************************/