From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40795 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwcMt-0004R0-U4 for qemu-devel@nongnu.org; Mon, 07 Mar 2011 10:29:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwcMs-0002Zp-Nx for qemu-devel@nongnu.org; Mon, 07 Mar 2011 10:29:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwcMs-0002Zg-CG for qemu-devel@nongnu.org; Mon, 07 Mar 2011 10:29:06 -0500 Message-ID: <4D74FA3C.1010205@redhat.com> Date: Mon, 07 Mar 2011 16:31:08 +0100 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH v2] Improve error handling in do_snapshot_blkdev() References: <1299158036-18481-1-git-send-email-Jes.Sorensen@redhat.com> <4D74ACFE.40908@redhat.com> <4D74F8AE.8000205@redhat.com> In-Reply-To: <4D74F8AE.8000205@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com Am 07.03.2011 16:24, schrieb Jes Sorensen: > On 03/07/11 11:01, Kevin Wolf wrote: >> Am 03.03.2011 14:13, schrieb Jes.Sorensen@redhat.com: >>> @@ -591,6 +592,12 @@ int do_snapshot_blkdev(Monitor *mon, const QDict *qdict, QObject **ret_data) >>> goto out; >>> } >>> >>> + strncpy(old_filename, bs->filename, sizeof(old_filename)); >>> + old_filename[1023] = '\0'; >> >> qemu has pstrcpy() from cutils.c for this. > > I'll change it to use pstrcpy(). > >>> - abort(); >>> + qerror_report(QERR_OPEN_FILE_FAILED, filename); >>> + error_printf("do_snapshot_blkdev(): Unable to open newly created " >>> + "snapshot file: \n"); >>> + error_printf(" %s. Attempting to revert to original image %s\n", >> >> That should probably be a colon in "%s: Attempting..." Also, is the >> leading space intentional? > > The colon is already there prior to the \n" on the previous printf line. > The space was intentional, but maybe that will just confuse people so I > will remove it. I added a colon after image: in the last line instead. Sorry, I failed to read the context. It's the end of a sentence started in the line before, so having . instead of : after %s is correct, of course. Kevin