summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChad Loder <cloder@cvs.openbsd.org>2002-11-25 00:06:52 +0000
committerChad Loder <cloder@cvs.openbsd.org>2002-11-25 00:06:52 +0000
commit2bee3df3bdc04e92757e83bce22b48a08afb2a72 (patch)
tree3f0fec346a6340a3d0a7edd2301b0ad79e3fd26a /lib
parent995c63879436d2986d0f37735f88d7b71e336b6b (diff)
Warn if atexit(3) fails. Change some tabs to spaces. Use
STDERR_FILENO instead of 2. OK millert@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/malloc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 3cdacc59b9f..45a8cc8182e 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -8,7 +8,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: malloc.c,v 1.51 2002/11/05 22:19:55 marc Exp $";
+static char rcsid[] = "$OpenBSD: malloc.c,v 1.52 2002/11/25 00:06:51 cloder Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -364,9 +364,9 @@ malloc_exit()
char *q = "malloc() warning: Couldn't dump stats.\n";
if (fd) {
malloc_dump(fd);
- fclose(fd);
+ fclose(fd);
} else
- write(2, q, strlen(q));
+ write(STDERR_FILENO, q, strlen(q));
}
#endif /* MALLOC_STATS */
@@ -534,8 +534,8 @@ malloc_init ()
malloc_junk=1;
#ifdef MALLOC_STATS
- if (malloc_stats)
- atexit(malloc_exit);
+ if (malloc_stats && (atexit(malloc_exit) == -1))
+ wrtwarning("atexit(2) failed. Will not be able to dump malloc stats on exit.\n");
#endif /* MALLOC_STATS */
/* Allocate one page for the page directory */