diff options
| author | martin <martin@NetBSD.org> | 2017-08-01 12:31:45 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2017-08-01 12:31:45 +0000 |
| commit | b75e5d64cc7750cf92330e4067280797ea39844c (patch) | |
| tree | 40a1f7c2c3ac6c32f35e594b7bbaaac4f7fdd137 /lib/libpthread | |
| parent | 80fa2c98d61890c3e419fd0b5f57bbbdff806916 (diff) | |
pthread__attr_init_private:
malloc+memset -> calloc. Also initialize all values to the proper
defaults.
This fixes the "rustc panic" discussed on pkgsrc-users.
OK: joerg
Diffstat (limited to 'lib/libpthread')
| -rw-r--r-- | lib/libpthread/pthread_attr.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libpthread/pthread_attr.c b/lib/libpthread/pthread_attr.c index 7f4f4b8cc78..abe8e52b10e 100644 --- a/lib/libpthread/pthread_attr.c +++ b/lib/libpthread/pthread_attr.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread_attr.c,v 1.17 2017/07/02 16:41:32 joerg Exp $ */ +/* $NetBSD: pthread_attr.c,v 1.18 2017/08/01 12:31:45 martin Exp $ */ /*- * Copyright (c) 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: pthread_attr.c,v 1.17 2017/07/02 16:41:32 joerg Exp $"); +__RCSID("$NetBSD: pthread_attr.c,v 1.18 2017/08/01 12:31:45 martin Exp $"); #include <errno.h> #include <stdio.h> @@ -58,11 +58,12 @@ pthread__attr_init_private(pthread_attr_t *attr) if ((p = attr->pta_private) != NULL) return p; - p = malloc(sizeof(*p)); + p = calloc(1, sizeof(*p)); if (p != NULL) { - memset(p, 0, sizeof(*p)); attr->pta_private = p; p->ptap_policy = SCHED_OTHER; + p->ptap_stacksize = pthread__stacksize; + p->ptap_guardsize = pthread__guardsize; } return p; } |
