summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorderaadt <>2002-07-31 09:19:04 +0000
committerderaadt <>2002-07-31 09:19:04 +0000
commita61a213f9ae18d6b4d22d37d67709147cf7506f6 (patch)
treed98c09410d1e3abbb69e73c6df8129ea0e0ed194 /src/lib
parent792dc17800d0d6f1c7736658fd73211972d505aa (diff)
downloadopenbsd-a61a213f9ae18d6b4d22d37d67709147cf7506f6.tar.gz
openbsd-a61a213f9ae18d6b4d22d37d67709147cf7506f6.tar.bz2
openbsd-a61a213f9ae18d6b4d22d37d67709147cf7506f6.zip
permit calloc(0, N) and calloc(N, 0) -- malloc(0) does the right thing; markus miod ok
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/stdlib/calloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/calloc.c b/src/lib/libc/stdlib/calloc.c
index c53b22b431..c75b256d14 100644
--- a/src/lib/libc/stdlib/calloc.c
+++ b/src/lib/libc/stdlib/calloc.c
@@ -32,7 +32,7 @@
32 */ 32 */
33 33
34#if defined(LIBC_SCCS) && !defined(lint) 34#if defined(LIBC_SCCS) && !defined(lint)
35static char *rcsid = "$OpenBSD: calloc.c,v 1.6 2002/07/30 00:11:07 deraadt Exp $"; 35static char *rcsid = "$OpenBSD: calloc.c,v 1.7 2002/07/31 09:19:04 deraadt Exp $";
36#endif /* LIBC_SCCS and not lint */ 36#endif /* LIBC_SCCS and not lint */
37 37
38#include <stdlib.h> 38#include <stdlib.h>
@@ -47,7 +47,7 @@ calloc(num, size)
47{ 47{
48 register void *p; 48 register void *p;
49 49
50 if (SIZE_T_MAX / num < size) { 50 if (num && size && SIZE_T_MAX / num < size) {
51 errno = ENOMEM; 51 errno = ENOMEM;
52 return NULL; 52 return NULL;
53 } 53 }