From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3002 invoked from network); 1 Feb 2000 18:42:55 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Feb 2000 18:42:55 -0000 Received: (qmail 27397 invoked by alias); 1 Feb 2000 18:42:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9514 Received: (qmail 27385 invoked from network); 1 Feb 2000 18:42:47 -0000 To: ZSH-workers@sunsite.auc.dk Subject: Re: PATCH: mmap error In-reply-to: "Clint Adams"'s message of "Mon, 31 Jan 2000 13:35:46 EST." <20000131133546.A13537@dman.com> Date: Tue, 01 Feb 2000 18:45:39 +0000 From: Peter Stephenson Message-Id: 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