From 9fb4749f7ee4bbc75e0ad571a87abd76a0ae1b81 Mon Sep 17 00:00:00 2001
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
Date: Tue, 29 Nov 2022 08:15:11 +0000
Subject: [PATCH 01/24] virsh: cmdScreenshot: fix cbdata passing to 
 virshStreamSink 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.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix it in cmdScreenshot as well.

https://bugzilla.redhat.com/show_bug.cgi?id=1875195

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 9e745a97171e10f050962c166082439d6724e245
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

Signed-off-by: tangbin <tangbin_yewu@cmss.chinamobile.com>
(cherry-pick from 3144e881b137123b0326157ce6dc23ca649c9270)
---
 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 7033232015..c043ad3ce5 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5632,6 +5632,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;
@@ -5667,7 +5668,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.27.0

