summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2008-09-03 21:29:30 +0000
committermiod <miod@openbsd.org>2008-09-03 21:29:30 +0000
commit0fdb2e60c1e8eb0634a8e9211b8adf1df5c8f7a8 (patch)
treec869f941ef8206683930846a9add2e7e8e0a60c6
parentthird parameter of ieee80211_get_assoc_req() is a management frame (diff)
downloadwireguard-openbsd-0fdb2e60c1e8eb0634a8e9211b8adf1df5c8f7a8.tar.xz
wireguard-openbsd-0fdb2e60c1e8eb0634a8e9211b8adf1df5c8f7a8.zip
Provide our own calloc() since we provide our own malloc(), otherwise we won't
be able to link against libc_pic.a anyway.
-rw-r--r--gnu/usr.bin/ld/rtld/malloc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gnu/usr.bin/ld/rtld/malloc.c b/gnu/usr.bin/ld/rtld/malloc.c
index 3ad09c1f245..af8fc1b7630 100644
--- a/gnu/usr.bin/ld/rtld/malloc.c
+++ b/gnu/usr.bin/ld/rtld/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.9 2003/06/02 19:55:59 millert Exp $ */
+/* $OpenBSD: malloc.c,v 1.10 2008/09/03 21:29:30 miod Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -31,7 +31,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)malloc.c 5.11 (Berkeley) 2/23/91";*/
-static char *rcsid = "$OpenBSD: malloc.c,v 1.9 2003/06/02 19:55:59 millert Exp $";
+static char *rcsid = "$OpenBSD: malloc.c,v 1.10 2008/09/03 21:29:30 miod Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -471,3 +471,18 @@ morepages(int n)
#endif
return n;
}
+
+void *
+calloc(size_t num, size_t size)
+{
+ void *p;
+
+ if (num && SIZE_MAX / num < size) {
+ return NULL;
+ }
+ size *= num;
+ p = malloc(size);
+ if (p)
+ memset(p, 0, size);
+ return(p);
+}