From 182b05e19e6be7013d4fe15f98983cb78b92c3ec Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 22 Sep 1995 14:11:00 +0000 Subject: [PATCH] A buglet when dumping and a stylistic point from Mike. Submitted by: Mike Pritchard --- lib/libc/stdlib/malloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 421faf3cfb72..b521bb089768 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: malloc.c,v 1.3 1995/09/16 09:28:13 phk Exp $ * */ @@ -319,9 +319,12 @@ static void malloc_exit() { FILE *fd = fopen("malloc.out","a"); - if (fd) + char *q = "malloc() warning: Couldn't dump stats.\n"; + if (fd) { malloc_dump(fd); - fclose(fd); + fclose(fd); + } else + write(2,q,strlen(q)); } @@ -340,11 +343,8 @@ map_pages(int pages, int update) last_index = ((u_long)tail >> malloc_pageshift) - malloc_origo -1; malloc_brk = tail; TRACE(("%6d S %p .. %p\n",malloc_event++, result, tail)); - if (update && - last_index >= malloc_ninfo && - !extend_page_directory(last_index)) - ; - else + if (!update || last_index < malloc_ninfo || + extend_page_directory(last_index)) return result; } TRACE(("%6d s %d %p %d\n",malloc_event++,pages,sbrk(0),errno));