Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: mmap error
- X-seq: zsh-workers 9514
 
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
 
- To: ZSH-workers@xxxxxxxxxxxxxx
 
- Subject: Re: PATCH: mmap error
 
- Date: Tue, 01 Feb 2000 18:45:39 +0000
 
- In-reply-to: "Clint Adams"'s message of "Mon, 31 Jan 2000 13:35:46 EST."             <20000131133546.A13537@xxxxxxxx> 
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
 
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