From 91389a020705c549de9b46dfaa18c1466deadf76 Mon Sep 17 00:00:00 2001 From: Ray Lai Date: Wed, 4 Aug 2010 21:28:18 +0000 Subject: exit(2) on xcalloc failure. From Daniel Dickman , thanks! OK deraadt --- usr.bin/diff/xmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr.bin/diff') 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 * Copyright (c) 1995 Tatu Ylonen , 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; } -- cgit v1.2.3