diff mbox

[1/3] qemu_chr_new_from_opts: do not overwrite existing chr->filename

Message ID 1369678422-658-1-git-send-email-stefano.stabellini@eu.citrix.com
State New
Headers show

Commit Message

Stefano Stabellini May 27, 2013, 6:13 p.m. UTC
Set the new filename only if it hasn't been already set (for example by
qemu_chr_open_pty).

This fixes a regression that prevents Xen HVM domains from booting.
It was introduced by:

commit 2b220025993e76d4116781ca91a4fabc5ad9c722
Author: Lei Li <lilei@linux.vnet.ibm.com>
Date:   Tue May 21 18:27:59 2013 +0800

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 qemu-char.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Comments

Gerd Hoffmann May 28, 2013, 6:37 a.m. UTC | #1
On 05/27/13 20:13, Stefano Stabellini wrote:
> Set the new filename only if it hasn't been already set (for example by
> qemu_chr_open_pty).
> 
> This fixes a regression that prevents Xen HVM domains from booting.
> It was introduced by:
> 
> commit 2b220025993e76d4116781ca91a4fabc5ad9c722
> Author: Lei Li <lilei@linux.vnet.ibm.com>
> Date:   Tue May 21 18:27:59 2013 +0800

FYI: just posted a pull req which reverts this one (you are cc'ed).

cheers,
  Gerd
Stefano Stabellini May 28, 2013, 10:43 a.m. UTC | #2
On Tue, 28 May 2013, Gerd Hoffmann wrote:
> On 05/27/13 20:13, Stefano Stabellini wrote:
> > Set the new filename only if it hasn't been already set (for example by
> > qemu_chr_open_pty).
> > 
> > This fixes a regression that prevents Xen HVM domains from booting.
> > It was introduced by:
> > 
> > commit 2b220025993e76d4116781ca91a4fabc5ad9c722
> > Author: Lei Li <lilei@linux.vnet.ibm.com>
> > Date:   Tue May 21 18:27:59 2013 +0800
> 
> FYI: just posted a pull req which reverts this one (you are cc'ed).

Right, your two patches also solve the problem I was seeing.
I'll drop the first patch of my series.
Stefano Stabellini May 28, 2013, 10:44 a.m. UTC | #3
On Mon, 27 May 2013, Stefano Stabellini wrote:
> Set the new filename only if it hasn't been already set (for example by
> qemu_chr_open_pty).
> 
> This fixes a regression that prevents Xen HVM domains from booting.
> It was introduced by:
> 
> commit 2b220025993e76d4116781ca91a4fabc5ad9c722
> Author: Lei Li <lilei@linux.vnet.ibm.com>
> Date:   Tue May 21 18:27:59 2013 +0800
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Gerd submitted an alternative fix to this issue here:

http://marc.info/?l=qemu-devel&m=136972286727453

I'll drop this patch.


>  qemu-char.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 4f8382e..06ffd93 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -3276,7 +3276,6 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
>          ChardevReturn *ret = NULL;
>          const char *id = qemu_opts_id(opts);
>          const char *bid = NULL;
> -        char *filename = g_strdup(qemu_opt_get(opts, "backend"));
>  
>          if (qemu_opt_get_bool(opts, "mux", 0)) {
>              bid = g_strdup_printf("%s-base", id);
> @@ -3309,7 +3308,9 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
>          }
>  
>          chr = qemu_chr_find(id);
> -        chr->filename = filename;
> +        if (!chr->filename) {
> +            chr->filename = g_strdup(qemu_opt_get(opts, "backend"));
> +        }
>  
>      qapi_out:
>          qapi_free_ChardevBackend(backend);
> -- 
> 1.7.2.5
>
diff mbox

Patch

diff --git a/qemu-char.c b/qemu-char.c
index 4f8382e..06ffd93 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3276,7 +3276,6 @@  CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
         ChardevReturn *ret = NULL;
         const char *id = qemu_opts_id(opts);
         const char *bid = NULL;
-        char *filename = g_strdup(qemu_opt_get(opts, "backend"));
 
         if (qemu_opt_get_bool(opts, "mux", 0)) {
             bid = g_strdup_printf("%s-base", id);
@@ -3309,7 +3308,9 @@  CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
         }
 
         chr = qemu_chr_find(id);
-        chr->filename = filename;
+        if (!chr->filename) {
+            chr->filename = g_strdup(qemu_opt_get(opts, "backend"));
+        }
 
     qapi_out:
         qapi_free_ChardevBackend(backend);