[libvirt PATCH] virsh: cmdScreenshot: fix cbdata passing to virshStreamSink

Ján Tomko posted 1 patch 2 weeks ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/9a228f5e582d9daa3022077c747571eec3c41313.1599642315.git.jtomko@redhat.com
tools/virsh-domain.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

[libvirt PATCH] virsh: cmdScreenshot: fix cbdata passing to virshStreamSink

Posted by Ján Tomko 2 weeks ago
The changes for sparse stream support started passing
virshStreamCallbackDataPtr to virshStreamSink
instead of passing a simple file descriptor, but
forgot to adjust all the callers.

Fix it in cmdScreenshot as well.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 9e745a97171e10f050962c166082439d6724e245
https://bugzilla.redhat.com/show_bug.cgi?id=1875195
---
 tools/virsh-domain.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 31597ee469..d1d3f8e566 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5628,6 +5628,7 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
     bool generated = false;
     char *mime = NULL;
     virshControlPtr priv = ctl->privData;
+    virshStreamCallbackData cbdata;
 
     if (vshCommandOptStringReq(ctl, cmd, "file", (const char **) &file) < 0)
         return false;
@@ -5663,7 +5664,10 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
         created = true;
     }
 
-    if (virStreamRecvAll(st, virshStreamSink, &fd) < 0) {
+    cbdata.ctl = ctl;
+    cbdata.fd = fd;
+
+    if (virStreamRecvAll(st, virshStreamSink, &cbdata) < 0) {
         vshError(ctl, _("could not receive data from domain %s"), name);
         goto cleanup;
     }
-- 
2.26.2

Re: [libvirt PATCH] virsh: cmdScreenshot: fix cbdata passing to virshStreamSink

Posted by Martin Kletzander 2 weeks ago
On Wed, Sep 09, 2020 at 11:05:37AM +0200, Ján Tomko wrote:
>The changes for sparse stream support started passing
>virshStreamCallbackDataPtr to virshStreamSink
>instead of passing a simple file descriptor, but
>forgot to adjust all the callers.
>
>Fix it in cmdScreenshot as well.
>
>Signed-off-by: Ján Tomko <jtomko@redhat.com>
>Fixes: 9e745a97171e10f050962c166082439d6724e245
>https://bugzilla.redhat.com/show_bug.cgi?id=1875195
>---

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

> tools/virsh-domain.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
>index 31597ee469..d1d3f8e566 100644
>--- a/tools/virsh-domain.c
>+++ b/tools/virsh-domain.c
>@@ -5628,6 +5628,7 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
>     bool generated = false;
>     char *mime = NULL;
>     virshControlPtr priv = ctl->privData;
>+    virshStreamCallbackData cbdata;
>
>     if (vshCommandOptStringReq(ctl, cmd, "file", (const char **) &file) < 0)
>         return false;
>@@ -5663,7 +5664,10 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
>         created = true;
>     }
>
>-    if (virStreamRecvAll(st, virshStreamSink, &fd) < 0) {
>+    cbdata.ctl = ctl;
>+    cbdata.fd = fd;
>+
>+    if (virStreamRecvAll(st, virshStreamSink, &cbdata) < 0) {
>         vshError(ctl, _("could not receive data from domain %s"), name);
>         goto cleanup;
>     }
>-- 
>2.26.2
>