diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 70e7f37d..af9cf391 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.250 2018/11/05 08:23:40 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.251 2018/11/06 08:01:43 otto Exp $ */ /* * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek * Copyright (c) 2012 Matthew Dempsky @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -386,8 +388,9 @@ omalloc_parseopt(char opt) static void omalloc_init(void) { - char *p, *q, b[64]; - int i, j; + char *p, *q, b[16]; + int i, j, mib[2]; + size_t sb; /* * Default options @@ -398,10 +401,12 @@ omalloc_init(void) for (i = 0; i < 3; i++) { switch (i) { case 0: - j = readlink("/etc/malloc.conf", b, sizeof b - 1); - if (j <= 0) + mib[0] = CTL_VM; + mib[1] = VM_MALLOC_CONF; + sb = sizeof(b); + j = sysctl(mib, 2, b, &sb, NULL, 0); + if (j != 0) continue; - b[j] = '\0'; p = b; break; case 1: