|
|
7b23b6 |
From 769465494c5e3e4299a2dfdf6e0c835be4e04ab7 Mon Sep 17 00:00:00 2001
|
|
|
7b23b6 |
From: Frediano Ziglio <fziglio@redhat.com>
|
|
|
7b23b6 |
Date: Thu, 19 Mar 2020 06:12:34 +0000
|
|
|
7b23b6 |
Subject: [PATCH 9/9] channel-main: Handle some detailed error for
|
|
|
7b23b6 |
VD_AGENT_FILE_XFER_STATUS_ERROR
|
|
|
7b23b6 |
|
|
|
7b23b6 |
Detect presence of detail on VD_AGENT_FILE_XFER_STATUS_ERROR and
|
|
|
7b23b6 |
if the error is supported give more detailed information, otherwise
|
|
|
7b23b6 |
fallback to the old generic error.
|
|
|
7b23b6 |
|
|
|
7b23b6 |
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
|
|
|
7b23b6 |
Acked-by: Victor Toso <victortoso@redhat.com>
|
|
|
7b23b6 |
(cherry picked from commit d79b05dcff83792c8415cafbb288d614de9d3101)
|
|
|
7b23b6 |
---
|
|
|
7b23b6 |
src/channel-main.c | 22 +++++++++++++++++++---
|
|
|
7b23b6 |
1 file changed, 19 insertions(+), 3 deletions(-)
|
|
|
7b23b6 |
|
|
|
7b23b6 |
diff --git a/src/channel-main.c b/src/channel-main.c
|
|
|
7b23b6 |
index c4fe02b..d845fda 100644
|
|
|
7b23b6 |
--- a/src/channel-main.c
|
|
|
7b23b6 |
+++ b/src/channel-main.c
|
|
|
7b23b6 |
@@ -1913,10 +1913,26 @@ static void main_agent_handle_xfer_status(SpiceMainChannel *channel,
|
|
|
7b23b6 |
error = g_error_new_literal(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
|
|
|
7b23b6 |
_("The spice agent cancelled the file transfer"));
|
|
|
7b23b6 |
break;
|
|
|
7b23b6 |
- case VD_AGENT_FILE_XFER_STATUS_ERROR:
|
|
|
7b23b6 |
- error = g_error_new_literal(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
|
|
|
7b23b6 |
- _("The spice agent reported an error during the file transfer"));
|
|
|
7b23b6 |
+ case VD_AGENT_FILE_XFER_STATUS_ERROR: {
|
|
|
7b23b6 |
+ const VDAgentFileXferStatusError *err = (VDAgentFileXferStatusError *) msg->data;
|
|
|
7b23b6 |
+ if (test_agent_cap(channel, VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS) &&
|
|
|
7b23b6 |
+ msg_hdr->size >= sizeof(*msg) + sizeof(*err) &&
|
|
|
7b23b6 |
+ err->error_type == VD_AGENT_FILE_XFER_STATUS_ERROR_GLIB_IO) {
|
|
|
7b23b6 |
+
|
|
|
7b23b6 |
+ switch (err->error_code) {
|
|
|
7b23b6 |
+ case G_IO_ERROR_INVALID_FILENAME:
|
|
|
7b23b6 |
+ error = g_error_new_literal(G_IO_ERROR, err->error_code,
|
|
|
7b23b6 |
+ _("Invalid filename of transferred file"));
|
|
|
7b23b6 |
+ break;
|
|
|
7b23b6 |
+ }
|
|
|
7b23b6 |
+ }
|
|
|
7b23b6 |
+ if (error == NULL) {
|
|
|
7b23b6 |
+ error = g_error_new_literal(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
|
|
|
7b23b6 |
+ _("The spice agent reported an error "
|
|
|
7b23b6 |
+ "during the file transfer"));
|
|
|
7b23b6 |
+ }
|
|
|
7b23b6 |
break;
|
|
|
7b23b6 |
+ }
|
|
|
7b23b6 |
case VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE: {
|
|
|
7b23b6 |
const VDAgentFileXferStatusNotEnoughSpace *err =
|
|
|
7b23b6 |
(VDAgentFileXferStatusNotEnoughSpace*) msg->data;
|
|
|
7b23b6 |
--
|
|
|
7b23b6 |
2.26.2
|
|
|
7b23b6 |
|