summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/xmalloc.c
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2010-08-04 21:28:17 +0000
committerray <ray@openbsd.org>2010-08-04 21:28:17 +0000
commit7b613089557d9f8ce17c005f6c887bbc07380f11 (patch)
tree6f3ddf32395336b572c54c71151067f8479d9a30 /usr.bin/diff/xmalloc.c
parenton resume: calling sc_power after ath_init() is silly. ath_init() (diff)
downloadwireguard-openbsd-7b613089557d9f8ce17c005f6c887bbc07380f11.tar.xz
wireguard-openbsd-7b613089557d9f8ce17c005f6c887bbc07380f11.zip
exit(2) on xcalloc failure. From Daniel Dickman <didickman () gmail
! com>, thanks! OK deraadt
Diffstat (limited to 'usr.bin/diff/xmalloc.c')
-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;
}