qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] pc.c: better error message on initrd sizing fai


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] pc.c: better error message on initrd sizing failure
Date: Sun, 2 Feb 2014 20:46:35 +0000

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]