summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortedu <>2016-01-06 17:57:22 +0000
committertedu <>2016-01-06 17:57:22 +0000
commit9fab5fb01ddbd59e5aa97edb223fd1e132231682 (patch)
tree9e720cdb3ef90683db00bae19fd31300ed7ccf16 /src
parentc0c3491a8e39b8f754d5d210441e118a58201189 (diff)
downloadopenbsd-9fab5fb01ddbd59e5aa97edb223fd1e132231682.tar.gz
openbsd-9fab5fb01ddbd59e5aa97edb223fd1e132231682.tar.bz2
openbsd-9fab5fb01ddbd59e5aa97edb223fd1e132231682.zip
Long ago, malloc internally had two kinds of failures, warnings and errors.
The 'A' option elevated warnings to errors, and has been the default for some time. Then warnings were effectively eliminated in favor of everything being an error, but then the 'a' flag turned real errors into warnings! Remove the 'a' option entirely. You shouldn't have used it anyway. ok tb tdeval
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/stdlib/malloc.39
-rw-r--r--src/lib/libc/stdlib/malloc.c12
2 files changed, 7 insertions, 14 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index 27645b5a80..6cb6011ae4 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" $OpenBSD: malloc.3,v 1.91 2015/09/14 13:08:01 schwarze Exp $ 33.\" $OpenBSD: malloc.3,v 1.92 2016/01/06 17:57:22 tedu Exp $
34.\" 34.\"
35.Dd $Mdocdate: September 14 2015 $ 35.Dd $Mdocdate: January 6 2016 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -345,10 +345,7 @@ or
345detect an error condition, 345detect an error condition,
346a message will be printed to file descriptor 346a message will be printed to file descriptor
3472 (not using stdio). 3472 (not using stdio).
348Errors will result in the process being aborted, 348Errors will result in the process being aborted.
349unless the
350.Cm a
351option has been specified.
352.Pp 349.Pp
353Here is a brief description of the error messages and what they mean: 350Here is a brief description of the error messages and what they mean:
354.Bl -tag -width Ds 351.Bl -tag -width Ds
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c
index 7d64be89a9..23e076bdaf 100644
--- a/src/lib/libc/stdlib/malloc.c
+++ b/src/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: malloc.c,v 1.179 2015/12/30 06:04:39 tedu Exp $ */ 1/* $OpenBSD: malloc.c,v 1.180 2016/01/06 17:57:22 tedu Exp $ */
2/* 2/*
3 * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net>
4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> 4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -177,7 +177,6 @@ struct chunk_info {
177 177
178struct malloc_readonly { 178struct malloc_readonly {
179 struct dir_info *malloc_pool; /* Main bookkeeping information */ 179 struct dir_info *malloc_pool; /* Main bookkeeping information */
180 int malloc_abort; /* abort() on error */
181 int malloc_freenow; /* Free quickly - disable chunk rnd */ 180 int malloc_freenow; /* Free quickly - disable chunk rnd */
182 int malloc_freeunmap; /* mprotect free pages PROT_NONE? */ 181 int malloc_freeunmap; /* mprotect free pages PROT_NONE? */
183 int malloc_hint; /* call madvice on free pages? */ 182 int malloc_hint; /* call madvice on free pages? */
@@ -280,8 +279,8 @@ wrterror(char *msg, void *p)
280#endif /* MALLOC_STATS */ 279#endif /* MALLOC_STATS */
281 280
282 errno = saved_errno; 281 errno = saved_errno;
283 if (mopts.malloc_abort) 282
284 abort(); 283 abort();
285} 284}
286 285
287static void 286static void
@@ -485,7 +484,6 @@ omalloc_init(struct dir_info **dp)
485 /* 484 /*
486 * Default options 485 * Default options
487 */ 486 */
488 mopts.malloc_abort = 1;
489 mopts.malloc_junk = 1; 487 mopts.malloc_junk = 1;
490 mopts.malloc_move = 1; 488 mopts.malloc_move = 1;
491 mopts.malloc_cache = MALLOC_DEFAULT_CACHE; 489 mopts.malloc_cache = MALLOC_DEFAULT_CACHE;
@@ -523,10 +521,8 @@ omalloc_init(struct dir_info **dp)
523 mopts.malloc_cache >>= 1; 521 mopts.malloc_cache >>= 1;
524 break; 522 break;
525 case 'a': 523 case 'a':
526 mopts.malloc_abort = 0;
527 break;
528 case 'A': 524 case 'A':
529 mopts.malloc_abort = 1; 525 /* ignored */
530 break; 526 break;
531 case 'c': 527 case 'c':
532 mopts.malloc_canaries = 0; 528 mopts.malloc_canaries = 0;