From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB8YD-00039H-IB for qemu-devel@nongnu.org; Wed, 05 Feb 2014 14:54:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WB8Y7-0005Q6-J8 for qemu-devel@nongnu.org; Wed, 05 Feb 2014 14:54:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB8Y7-0005Px-C3 for qemu-devel@nongnu.org; Wed, 05 Feb 2014 14:54:19 -0500 Date: Wed, 5 Feb 2014 21:59:14 +0200 From: "Michael S. Tsirkin" Message-ID: <20140205195914.GA8017@redhat.com> References: <20140202204607.GA21698@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] pc.c: better error message on initrd sizing failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Andreas =?iso-8859-1?Q?F=E4rber?= , QEMU Developers , Anthony Liguori , Igor Mammedov On Sun, Feb 02, 2014 at 08:46:35PM +0000, Peter Maydell wrote: > On 2 February 2014 20:46, Michael S. Tsirkin wrote: > > Signed-off-by: Michael S. Tsirkin > > --- > > hw/i386/pc.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > > index 348b15f..e715a33 100644 > > --- a/hw/i386/pc.c > > +++ b/hw/i386/pc.c > > @@ -835,8 +835,8 @@ static void load_linux(FWCfgState *fw_cfg, > > > > initrd_size = get_image_size(initrd_filename); > > if (initrd_size < 0) { > > - fprintf(stderr, "qemu: error reading initrd %s\n", > > - initrd_filename); > > + fprintf(stderr, "qemu: error reading initrd %s: %s\n", > > + initrd_filename, strerror(errno)); > > exit(1); > > get_image_size() happens to set errno on failure, but it > doesn't guarantee to -- all the doc comment says currently > is "return the size or -1 if error". If we're going to rely on > errno being set in the failure case it would be nice to at > least add an "(and errno is set)" to that. (Better still would > be to transfer the info into a properly formatted doc comment > for the prototype in include/hw/loader.h...) > > thanks > -- PMM Good idea. This patch doesn't have to change though - I'll post an additional one with the comment.