From patchwork Wed Oct 2 17:31:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dunrong huang X-Patchwork-Id: 280124 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 036C32C1E68 for ; Thu, 3 Oct 2013 04:06:04 +1000 (EST) Received: from localhost ([::1]:37306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRQoD-0004gW-Cd for incoming@patchwork.ozlabs.org; Wed, 02 Oct 2013 14:06:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRQnm-0004fm-ST for qemu-devel@nongnu.org; Wed, 02 Oct 2013 14:05:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRQng-00049Z-5R for qemu-devel@nongnu.org; Wed, 02 Oct 2013 14:05:34 -0400 Received: from [221.122.32.18] (port=28505 helo=hdr245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRQnf-00049E-58 for qemu-devel@nongnu.org; Wed, 02 Oct 2013 14:05:28 -0400 Received: from hdr245 (localhost [127.0.0.1]) by hdr245 (8.14.4/8.14.4) with ESMTP id r92HWS5S016451; Thu, 3 Oct 2013 01:32:28 +0800 Received: (from root@localhost) by hdr245 (8.14.4/8.14.4/Submit) id r92HWRQa016443; Thu, 3 Oct 2013 01:32:27 +0800 From: Dunrong Huang To: qemu-devel Date: Thu, 3 Oct 2013 01:31:27 +0800 Message-Id: <1380735087-16406-1-git-send-email-riegamaths@gmail.com> X-Mailer: git-send-email 1.7.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 221.122.32.18 Cc: Kevin Wolf , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH] block: use correct filename 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 The content filename point to may be erased by qemu_opts_absorb_qdict() in raw_open_common() in drv->bdrv_file_open() So it's better to use bs->filename. Signed-off-by: Dunrong Huang Reviewed-by: Max Reitz --- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 93e113a..469d842 100644 --- a/block.c +++ b/block.c @@ -824,8 +824,8 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, #ifndef _WIN32 if (bs->is_temporary) { - assert(filename != NULL); - unlink(filename); + assert(bs->filename[0] != '\0'); + unlink(bs->filename); } #endif return 0;