From patchwork Thu Aug 7 08:01:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhanghailiang X-Patchwork-Id: 377781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DBF3914009C for ; Thu, 7 Aug 2014 18:06:46 +1000 (EST) Received: from localhost ([::1]:44058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFIii-0005sX-Uy for incoming@patchwork.ozlabs.org; Thu, 07 Aug 2014 04:06:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFIfy-00013f-HM for qemu-devel@nongnu.org; Thu, 07 Aug 2014 04:03:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFIft-0004xc-HU for qemu-devel@nongnu.org; Thu, 07 Aug 2014 04:03:54 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:5820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFIfs-0004ww-PR for qemu-devel@nongnu.org; Thu, 07 Aug 2014 04:03:49 -0400 Received: from 172.24.2.119 (EHLO szxeml404-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BXR79056; Thu, 07 Aug 2014 16:02:49 +0800 (CST) Received: from localhost (10.177.22.69) by szxeml404-hub.china.huawei.com (10.82.67.59) with Microsoft SMTP Server id 14.3.158.1; Thu, 7 Aug 2014 16:02:38 +0800 From: zhanghailiang To: Date: Thu, 7 Aug 2014 16:01:51 +0800 Message-ID: <1407398512-20780-10-git-send-email-zhang.zhanghailiang@huawei.com> X-Mailer: git-send-email 1.9.2.msysgit.0 In-Reply-To: <1407398512-20780-1-git-send-email-zhang.zhanghailiang@huawei.com> References: <1407398512-20780-1-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.22.69] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: kwolf@redhat.com, lkurusa@redhat.com, zhanghailiang , mst@redhat.com, jan.kiszka@siemens.com, riku.voipio@iki.fi, mjt@tls.msk.ru, peter.huangpeng@huawei.com, lcapitulino@redhat.com, stefanha@redhat.com, Li Liu , luonengjun@huawei.com, pbonzini@redhat.com, alex.bennee@linaro.org, rth@twiddle.net Subject: [Qemu-devel] [PATCH v3 09/10] tcg: check return value of fopen() 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: Li Liu Give a warning message if fopen() failed to open the log file. Signed-off-by: zhanghailiang Signed-off-by: Li Liu --- tcg/tcg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index c068990..8f50d2a 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2406,6 +2406,10 @@ static void dump_op_count(void) int i; FILE *f; f = fopen("/tmp/op.log", "w"); + if (f == NULL) { + fprintf(stderr, "Failed to open /tmp/op.log\n"); + return; + } for(i = INDEX_op_end; i < NB_OPS; i++) { fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, tcg_table_op_count[i]); }