Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: mmap error



Clint Adams wrote:
> This is not an elegant solution.  Of course, I'm not even sure that it works.
> The point is to not segfault after mmap failure.

The following is basically the same, but more consistent with the other
allocation failures in mem.c

--- Src/mem.c.err	Mon Jan 31 20:09:54 2000
+++ Src/mem.c	Mon Jan 31 20:10:40 2000
@@ -356,6 +356,10 @@
 	    n = (n + pgsz) & ~pgsz;
 	    h = (Heap) mmap(NULL, n, PROT_READ | PROT_WRITE,
 			    MMAP_FLAGS, -1, 0);
+	    if (!h) {
+		zerr("fatal error: mmap failed", NULL, 0);
+		exit(1);
+	    }
 	    h->size = n;
 	}
 #else

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>



Messages sorted by: Reverse Date, Date, Thread, Author