qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vl.c: Don't print errno after failed qemu_chr_new()
@ 2012-07-09 14:28 Peter Maydell
  2012-07-21  9:07 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2012-07-09 14:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Christian Müller, Anthony Liguori, patches

The qemu_chr_new() function doesn't set errno on failure, so
don't print strerror(errno) on the error handling path when
dealing with the -serial, -parallel and -virtioconsole arguments.
This avoids nonsensical error messages like:
  $ ./arm-softmmu/qemu-system-arm -serial wombat
  qemu: could not open serial device 'wombat': Success

We also rephrase the message slightly to make it a little clearer
that we're expecting the name of a QEMU chr backend rather than
a host or guest serial/parallel/etc device.

Reported-by: Christian Müller <christian.mueller@heig-vd.ch>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 vl.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/vl.c b/vl.c
index 1329c30..8d49ff0 100644
--- a/vl.c
+++ b/vl.c
@@ -1985,8 +1985,8 @@ static int serial_parse(const char *devname)
     snprintf(label, sizeof(label), "serial%d", index);
     serial_hds[index] = qemu_chr_new(label, devname, NULL);
     if (!serial_hds[index]) {
-        fprintf(stderr, "qemu: could not open serial device '%s': %s\n",
-                devname, strerror(errno));
+        fprintf(stderr, "qemu: could not connect serial device"
+                " to character backend '%s'\n", devname);
         return -1;
     }
     index++;
@@ -2007,8 +2007,8 @@ static int parallel_parse(const char *devname)
     snprintf(label, sizeof(label), "parallel%d", index);
     parallel_hds[index] = qemu_chr_new(label, devname, NULL);
     if (!parallel_hds[index]) {
-        fprintf(stderr, "qemu: could not open parallel device '%s': %s\n",
-                devname, strerror(errno));
+        fprintf(stderr, "qemu: could not connect parallel device"
+                " to character backend '%s'\n", devname);
         return -1;
     }
     index++;
@@ -2042,8 +2042,8 @@ static int virtcon_parse(const char *devname)
     snprintf(label, sizeof(label), "virtcon%d", index);
     virtcon_hds[index] = qemu_chr_new(label, devname, NULL);
     if (!virtcon_hds[index]) {
-        fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",
-                devname, strerror(errno));
+        fprintf(stderr, "qemu: could not connect virtio console"
+                " to character backend '%s'\n", devname);
         return -1;
     }
     qemu_opt_set(dev_opts, "chardev", label);
-- 
1.7.1

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

* Re: [Qemu-devel] [PATCH] vl.c: Don't print errno after failed qemu_chr_new()
  2012-07-09 14:28 [Qemu-devel] [PATCH] vl.c: Don't print errno after failed qemu_chr_new() Peter Maydell
@ 2012-07-21  9:07 ` Peter Maydell
  2012-07-28 12:14   ` Blue Swirl
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2012-07-21  9:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Christian Müller, Anthony Liguori, patches

Ping?

patchwork url: http://patchwork.ozlabs.org/patch/169860/

-- PMM

On 9 July 2012 15:28, Peter Maydell <peter.maydell@linaro.org> wrote:
> The qemu_chr_new() function doesn't set errno on failure, so
> don't print strerror(errno) on the error handling path when
> dealing with the -serial, -parallel and -virtioconsole arguments.
> This avoids nonsensical error messages like:
>   $ ./arm-softmmu/qemu-system-arm -serial wombat
>   qemu: could not open serial device 'wombat': Success
>
> We also rephrase the message slightly to make it a little clearer
> that we're expecting the name of a QEMU chr backend rather than
> a host or guest serial/parallel/etc device.
>
> Reported-by: Christian Müller <christian.mueller@heig-vd.ch>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  vl.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 1329c30..8d49ff0 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1985,8 +1985,8 @@ static int serial_parse(const char *devname)
>      snprintf(label, sizeof(label), "serial%d", index);
>      serial_hds[index] = qemu_chr_new(label, devname, NULL);
>      if (!serial_hds[index]) {
> -        fprintf(stderr, "qemu: could not open serial device '%s': %s\n",
> -                devname, strerror(errno));
> +        fprintf(stderr, "qemu: could not connect serial device"
> +                " to character backend '%s'\n", devname);
>          return -1;
>      }
>      index++;
> @@ -2007,8 +2007,8 @@ static int parallel_parse(const char *devname)
>      snprintf(label, sizeof(label), "parallel%d", index);
>      parallel_hds[index] = qemu_chr_new(label, devname, NULL);
>      if (!parallel_hds[index]) {
> -        fprintf(stderr, "qemu: could not open parallel device '%s': %s\n",
> -                devname, strerror(errno));
> +        fprintf(stderr, "qemu: could not connect parallel device"
> +                " to character backend '%s'\n", devname);
>          return -1;
>      }
>      index++;
> @@ -2042,8 +2042,8 @@ static int virtcon_parse(const char *devname)
>      snprintf(label, sizeof(label), "virtcon%d", index);
>      virtcon_hds[index] = qemu_chr_new(label, devname, NULL);
>      if (!virtcon_hds[index]) {
> -        fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",
> -                devname, strerror(errno));
> +        fprintf(stderr, "qemu: could not connect virtio console"
> +                " to character backend '%s'\n", devname);
>          return -1;
>      }
>      qemu_opt_set(dev_opts, "chardev", label);
> --
> 1.7.1
>
>

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

* Re: [Qemu-devel] [PATCH] vl.c: Don't print errno after failed qemu_chr_new()
  2012-07-21  9:07 ` Peter Maydell
@ 2012-07-28 12:14   ` Blue Swirl
  0 siblings, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2012-07-28 12:14 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Christian Müller, Anthony Liguori, qemu-devel, patches

On Sat, Jul 21, 2012 at 9:07 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Ping?
>
> patchwork url: http://patchwork.ozlabs.org/patch/169860/

Thanks, applied.

>
> -- PMM
>
> On 9 July 2012 15:28, Peter Maydell <peter.maydell@linaro.org> wrote:
>> The qemu_chr_new() function doesn't set errno on failure, so
>> don't print strerror(errno) on the error handling path when
>> dealing with the -serial, -parallel and -virtioconsole arguments.
>> This avoids nonsensical error messages like:
>>   $ ./arm-softmmu/qemu-system-arm -serial wombat
>>   qemu: could not open serial device 'wombat': Success
>>
>> We also rephrase the message slightly to make it a little clearer
>> that we're expecting the name of a QEMU chr backend rather than
>> a host or guest serial/parallel/etc device.
>>
>> Reported-by: Christian Müller <christian.mueller@heig-vd.ch>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>>  vl.c |   12 ++++++------
>>  1 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/vl.c b/vl.c
>> index 1329c30..8d49ff0 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -1985,8 +1985,8 @@ static int serial_parse(const char *devname)
>>      snprintf(label, sizeof(label), "serial%d", index);
>>      serial_hds[index] = qemu_chr_new(label, devname, NULL);
>>      if (!serial_hds[index]) {
>> -        fprintf(stderr, "qemu: could not open serial device '%s': %s\n",
>> -                devname, strerror(errno));
>> +        fprintf(stderr, "qemu: could not connect serial device"
>> +                " to character backend '%s'\n", devname);
>>          return -1;
>>      }
>>      index++;
>> @@ -2007,8 +2007,8 @@ static int parallel_parse(const char *devname)
>>      snprintf(label, sizeof(label), "parallel%d", index);
>>      parallel_hds[index] = qemu_chr_new(label, devname, NULL);
>>      if (!parallel_hds[index]) {
>> -        fprintf(stderr, "qemu: could not open parallel device '%s': %s\n",
>> -                devname, strerror(errno));
>> +        fprintf(stderr, "qemu: could not connect parallel device"
>> +                " to character backend '%s'\n", devname);
>>          return -1;
>>      }
>>      index++;
>> @@ -2042,8 +2042,8 @@ static int virtcon_parse(const char *devname)
>>      snprintf(label, sizeof(label), "virtcon%d", index);
>>      virtcon_hds[index] = qemu_chr_new(label, devname, NULL);
>>      if (!virtcon_hds[index]) {
>> -        fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",
>> -                devname, strerror(errno));
>> +        fprintf(stderr, "qemu: could not connect virtio console"
>> +                " to character backend '%s'\n", devname);
>>          return -1;
>>      }
>>      qemu_opt_set(dev_opts, "chardev", label);
>> --
>> 1.7.1
>>
>>
>

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

end of thread, other threads:[~2012-07-28 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-09 14:28 [Qemu-devel] [PATCH] vl.c: Don't print errno after failed qemu_chr_new() Peter Maydell
2012-07-21  9:07 ` Peter Maydell
2012-07-28 12:14   ` Blue Swirl

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).