diff options
author | cloder <> | 2002-11-25 00:06:51 +0000 |
---|---|---|
committer | cloder <> | 2002-11-25 00:06:51 +0000 |
commit | 6099547bdd329566c7d0de2622581e5ab234b47b (patch) | |
tree | d86c3b98f8e01e50804250749f07c64fa6ac6568 /src | |
parent | 82f5f5cc6f5a299ea502cad9b78326371fa65824 (diff) | |
download | openbsd-6099547bdd329566c7d0de2622581e5ab234b47b.tar.gz openbsd-6099547bdd329566c7d0de2622581e5ab234b47b.tar.bz2 openbsd-6099547bdd329566c7d0de2622581e5ab234b47b.zip |
Warn if atexit(3) fails. Change some tabs to spaces. Use
STDERR_FILENO instead of 2.
OK millert@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 3cdacc59b9..45a8cc8182 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #if defined(LIBC_SCCS) && !defined(lint) | 10 | #if defined(LIBC_SCCS) && !defined(lint) |
11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.51 2002/11/05 22:19:55 marc Exp $"; | 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.52 2002/11/25 00:06:51 cloder Exp $"; |
12 | #endif /* LIBC_SCCS and not lint */ | 12 | #endif /* LIBC_SCCS and not lint */ |
13 | 13 | ||
14 | /* | 14 | /* |
@@ -364,9 +364,9 @@ malloc_exit() | |||
364 | char *q = "malloc() warning: Couldn't dump stats.\n"; | 364 | char *q = "malloc() warning: Couldn't dump stats.\n"; |
365 | if (fd) { | 365 | if (fd) { |
366 | malloc_dump(fd); | 366 | malloc_dump(fd); |
367 | fclose(fd); | 367 | fclose(fd); |
368 | } else | 368 | } else |
369 | write(2, q, strlen(q)); | 369 | write(STDERR_FILENO, q, strlen(q)); |
370 | } | 370 | } |
371 | #endif /* MALLOC_STATS */ | 371 | #endif /* MALLOC_STATS */ |
372 | 372 | ||
@@ -534,8 +534,8 @@ malloc_init () | |||
534 | malloc_junk=1; | 534 | malloc_junk=1; |
535 | 535 | ||
536 | #ifdef MALLOC_STATS | 536 | #ifdef MALLOC_STATS |
537 | if (malloc_stats) | 537 | if (malloc_stats && (atexit(malloc_exit) == -1)) |
538 | atexit(malloc_exit); | 538 | wrtwarning("atexit(2) failed. Will not be able to dump malloc stats on exit.\n"); |
539 | #endif /* MALLOC_STATS */ | 539 | #endif /* MALLOC_STATS */ |
540 | 540 | ||
541 | /* Allocate one page for the page directory */ | 541 | /* Allocate one page for the page directory */ |