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