summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2010-08-04 21:28:18 +0000
committerRay Lai <ray@cvs.openbsd.org>2010-08-04 21:28:18 +0000
commit91389a020705c549de9b46dfaa18c1466deadf76 (patch)
tree4be4b1126081c440e99407ef7ddd02c2b3f75264
parenta3085b8ef365e10d6ea35c403c1047732bf467fd (diff)
exit(2) on xcalloc failure. From Daniel Dickman <didickman () gmail
! com>, thanks! OK deraadt
-rw-r--r--usr.bin/diff/xmalloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/diff/xmalloc.c b/usr.bin/diff/xmalloc.c
index b5340a9fa60..2e80e72e374 100644
--- a/usr.bin/diff/xmalloc.c
+++ b/usr.bin/diff/xmalloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.c,v 1.2 2009/06/07 08:39:13 ray Exp $ */
+/* $OpenBSD: xmalloc.c,v 1.3 2010/08/04 21:28:17 ray Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -41,12 +41,12 @@ xcalloc(size_t nmemb, size_t size)
void *ptr;
if (size == 0 || nmemb == 0)
- errx(1, "xcalloc: zero size");
+ errx(2, "xcalloc: zero size");
if (SIZE_MAX / nmemb < size)
- errx(1, "xcalloc: nmemb * size > SIZE_MAX");
+ errx(2, "xcalloc: nmemb * size > SIZE_MAX");
ptr = calloc(nmemb, size);
if (ptr == NULL)
- errx(1, "xcalloc: out of memory (allocating %lu bytes)",
+ errx(2, "xcalloc: out of memory (allocating %lu bytes)",
(u_long)(size * nmemb));
return ptr;
}