From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xo6Ot-0003QJ-Dn for qemu-devel@nongnu.org; Tue, 11 Nov 2014 03:02:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xo6On-0008GX-47 for qemu-devel@nongnu.org; Tue, 11 Nov 2014 03:02:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xo6Om-0008GN-SB for qemu-devel@nongnu.org; Tue, 11 Nov 2014 03:02:01 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAB81x6Y011180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 11 Nov 2014 03:01:59 -0500 Message-ID: <5461C274.8090106@redhat.com> Date: Tue, 11 Nov 2014 09:01:56 +0100 From: Max Reitz MIME-Version: 1.0 References: <1415638784-32311-1-git-send-email-mreitz@redhat.com> <1415638784-32311-2-git-send-email-mreitz@redhat.com> <54610ECF.4000301@redhat.com> In-Reply-To: <54610ECF.4000301@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/2] blkdebug: Simplify and improve filename generation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi On 2014-11-10 at 20:15, Eric Blake wrote: > On 11/10/2014 09:59 AM, Max Reitz wrote: >> Instead of actually recreating the options from scratch, just reuse the >> options given for creating the BDS, which are the configuration file >> name and additional options. In case there are no additional options we >> can thus create a plain filename. >> >> This obviously results in a different output for qemu-iotest 099 which >> exactly tests this filename generation. Fix it up as well. >> >> Signed-off-by: Max Reitz >> --- >> block/blkdebug.c | 98 +++++++++++++--------------------------------- >> tests/qemu-iotests/099.out | 4 +- >> 2 files changed, 29 insertions(+), 73 deletions(-) >> >> >> + if (!force_json && bs->file->exact_filename[0]) { >> + snprintf(bs->exact_filename, sizeof(bs->exact_filename), >> + "blkdebug:%s:%s", qdict_get_try_str(bs->options, "config"), > If there is no "config" entry, this can pass NULL as a %s counterpart to > snprintf, which is undefined behavior (works on glibc, but might crash > elsewhere). Well, depends on the definition of "works". "blkdebug:(null):foo" isn't that great either. > Everything else looked okay, but I'm afraid I may have given you reason > to post a v3 and make a kitten cry :( I do have a reason to post a v3, but the kitten would have to cry only if I had to post a v3 because there were no reviews. This way, everything is fine, thank you very much for your reviews (on the other series as well). :-) Max