From patchwork Fri Feb 10 14:34:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhiyong Wu X-Patchwork-Id: 140661 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2C1F9B6EF3 for ; Sat, 11 Feb 2012 01:34:55 +1100 (EST) Received: from localhost ([::1]:60550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvrYn-0003Gt-V2 for incoming@patchwork.ozlabs.org; Fri, 10 Feb 2012 09:34:49 -0500 Received: from eggs.gnu.org ([140.186.70.92]:47072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvrYZ-0003GW-NR for qemu-devel@nongnu.org; Fri, 10 Feb 2012 09:34:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvrYT-0007s8-Qd for qemu-devel@nongnu.org; Fri, 10 Feb 2012 09:34:35 -0500 Received: from e6.ny.us.ibm.com ([32.97.182.146]:39946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvrYT-0007s0-O9 for qemu-devel@nongnu.org; Fri, 10 Feb 2012 09:34:29 -0500 Received: from /spool/local by e6.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Feb 2012 09:34:28 -0500 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e6.ny.us.ibm.com (192.168.1.106) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 10 Feb 2012 09:34:24 -0500 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id D1B076E8061 for ; Fri, 10 Feb 2012 09:34:23 -0500 (EST) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q1AEYMb92777322 for ; Fri, 10 Feb 2012 09:34:22 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q1AEYMEm020396 for ; Fri, 10 Feb 2012 12:34:22 -0200 Received: from us.ibm.com (f15.cn.ibm.com [9.115.118.120] (may be forged)) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q1AEYIgo020132; Fri, 10 Feb 2012 12:34:19 -0200 Received: by us.ibm.com (sSMTP sendmail emulation); Fri, 10 Feb 2012 22:34:15 +0800 From: Zhi Yong Wu To: qemu-devel@nongnu.org Date: Fri, 10 Feb 2012 22:34:13 +0800 Message-Id: <1328884453-1067-1-git-send-email-zwu.kernel@gmail.com> X-Mailer: git-send-email 1.7.6 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12021014-1976-0000-0000-00000A5D4F62 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.182.146 Cc: Zhi Yong Wu , stefanha@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH] oslib: make error handling more reasonable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhi Yong Wu Signed-off-by: Zhi Yong Wu --- oslib-posix.c | 4 ++-- oslib-win32.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/oslib-posix.c b/oslib-posix.c index b6a3c7f..f978d56 100644 --- a/oslib-posix.c +++ b/oslib-posix.c @@ -80,7 +80,7 @@ void *qemu_oom_check(void *ptr) { if (ptr == NULL) { fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno)); - abort(); + exit(EXIT_FAILURE); } return ptr; } @@ -94,7 +94,7 @@ void *qemu_memalign(size_t alignment, size_t size) if (ret != 0) { fprintf(stderr, "Failed to allocate %zu B: %s\n", size, strerror(ret)); - abort(); + exit(EXIT_FAILURE); } #elif defined(CONFIG_BSD) ptr = qemu_oom_check(valloc(size)); diff --git a/oslib-win32.c b/oslib-win32.c index ce3021e..af2ff93 100644 --- a/oslib-win32.c +++ b/oslib-win32.c @@ -35,7 +35,7 @@ void *qemu_oom_check(void *ptr) { if (ptr == NULL) { fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError()); - abort(); + exit(EXIT_FAILURE); } return ptr; } @@ -45,7 +45,7 @@ void *qemu_memalign(size_t alignment, size_t size) void *ptr; if (!size) { - abort(); + exit(EXIT_FAILURE); } ptr = qemu_oom_check(VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE)); trace_qemu_memalign(alignment, size, ptr);