Patchwork multiboot: Quote filename in error message.

login
register
mail settings
Submitter Adam Lackorzynski
Date April 7, 2011, 6:22 p.m.
Message ID <1302200539-22908-1-git-send-email-adam@os.inf.tu-dresden.de>
Download mbox | patch
Permalink /patch/90221/
State New
Headers show

Comments

Adam Lackorzynski - April 7, 2011, 6:22 p.m.
Quote filename in error message to spot possible whitespace character in
the filename.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
 hw/multiboot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Alexander Graf - April 7, 2011, 10:44 p.m.
On 07.04.2011, at 20:22, Adam Lackorzynski wrote:

> Quote filename in error message to spot possible whitespace character in
> the filename.
> 
> Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
> ---
> hw/multiboot.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/multiboot.c b/hw/multiboot.c
> index 0d2bfb4..6be6fa0 100644
> --- a/hw/multiboot.c
> +++ b/hw/multiboot.c
> @@ -272,7 +272,7 @@ int load_multiboot(void *fw_cfg,
>             mb_debug("multiboot loading module: %s\n", initrd_filename);
>             mb_mod_length = get_image_size(initrd_filename);
>             if (mb_mod_length < 0) {
> -                fprintf(stderr, "failed to get %s image size\n", initrd_filename);
> +                fprintf(stderr, "failed to get image size of '%s'\n", initrd_filename);

I'd like to see something telling the user that the most likely reason is that the file isn't there :). It might even make sense to only say "Failed to open file '%s'".


Alex
Adam Lackorzynski - April 8, 2011, 6:48 a.m.
On Fri Apr 08, 2011 at 00:44:36 +0200, Alexander Graf wrote:
> 
> On 07.04.2011, at 20:22, Adam Lackorzynski wrote:
> 
> > Quote filename in error message to spot possible whitespace character in
> > the filename.
> > 
> > Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
> > ---
> > hw/multiboot.c |    2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/hw/multiboot.c b/hw/multiboot.c
> > index 0d2bfb4..6be6fa0 100644
> > --- a/hw/multiboot.c
> > +++ b/hw/multiboot.c
> > @@ -272,7 +272,7 @@ int load_multiboot(void *fw_cfg,
> >             mb_debug("multiboot loading module: %s\n", initrd_filename);
> >             mb_mod_length = get_image_size(initrd_filename);
> >             if (mb_mod_length < 0) {
> > -                fprintf(stderr, "failed to get %s image size\n", initrd_filename);
> > +                fprintf(stderr, "failed to get image size of '%s'\n", initrd_filename);
> 
> I'd like to see something telling the user that the most likely reason is that the file isn't there :). It might even make sense to only say "Failed to open file '%s'".

Looking at get_image_size() it's the right thing to do...



Adam

Patch

diff --git a/hw/multiboot.c b/hw/multiboot.c
index 0d2bfb4..6be6fa0 100644
--- a/hw/multiboot.c
+++ b/hw/multiboot.c
@@ -272,7 +272,7 @@  int load_multiboot(void *fw_cfg,
             mb_debug("multiboot loading module: %s\n", initrd_filename);
             mb_mod_length = get_image_size(initrd_filename);
             if (mb_mod_length < 0) {
-                fprintf(stderr, "failed to get %s image size\n", initrd_filename);
+                fprintf(stderr, "failed to get image size of '%s'\n", initrd_filename);
                 exit(1);
             }