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.

Hm, I think I prefer this one, it's the same as what we do in zalloc().

Bye
 Sven

diff -ru ../z.old/Src/mem.c Src/mem.c
--- ../z.old/Src/mem.c	Tue Feb  1 12:00:20 2000
+++ Src/mem.c	Tue Feb  1 14:06:53 2000
@@ -356,6 +356,10 @@
 	    n = (n + pgsz) & ~pgsz;
 	    h = (Heap) mmap(NULL, n, PROT_READ | PROT_WRITE,
 			    MMAP_FLAGS, -1, 0);
+	    if (h == ((Heap) -1)) {
+		zerr("fatal error: out of heap memory", NULL, 0);
+		exit(1);
+	    }
 	    h->size = n;
 	}
 #else

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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