qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pc.c: better error message on initrd sizing failure
@ 2014-02-02 20:46 Michael S. Tsirkin
  2014-02-02 20:46 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2014-02-02 20:46 UTC (permalink / raw)
  Cc: Michael S. Tsirkin, qemu-devel, Anthony Liguori, Paolo Bonzini,
	Igor Mammedov, Andreas Färber

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 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);
         }
 
-- 
MST

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] pc.c: better error message on initrd sizing failure
  2014-02-02 20:46 [Qemu-devel] [PATCH] pc.c: better error message on initrd sizing failure Michael S. Tsirkin
@ 2014-02-02 20:46 ` Peter Maydell
  2014-02-05 19:59   ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2014-02-02 20:46 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Paolo Bonzini, Andreas Färber, QEMU Developers,
	Anthony Liguori, Igor Mammedov

On 2 February 2014 20:46, Michael S. Tsirkin <mst@redhat.com> wrote:
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] pc.c: better error message on initrd sizing failure
  2014-02-02 20:46 ` Peter Maydell
@ 2014-02-05 19:59   ` Michael S. Tsirkin
  0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2014-02-05 19:59 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Andreas Färber, 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 <mst@redhat.com> wrote:
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-05 19:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-02 20:46 [Qemu-devel] [PATCH] pc.c: better error message on initrd sizing failure Michael S. Tsirkin
2014-02-02 20:46 ` Peter Maydell
2014-02-05 19:59   ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).