summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-09-03 21:29:31 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-09-03 21:29:31 +0000
commit10d18035b8e8dc306a76bfd638b4056e89e3dc4f (patch)
treeb9fb2706820ca2aae3ae523790fe40b5fd779230 /gnu
parentc0f37b1a30e7432b9171c654b15c52f080c662bc (diff)
Provide our own calloc() since we provide our own malloc(), otherwise we won't
be able to link against libc_pic.a anyway.
Diffstat (limited to 'gnu')
-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);
+}