[Spice-commits] src/channel-main.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri May 15 10:15:03 UTC 2020
src/channel-main.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
New commits:
commit d79b05dcff83792c8415cafbb288d614de9d3101
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Thu Mar 19 06:12:34 2020 +0000
channel-main: Handle some detailed error for VD_AGENT_FILE_XFER_STATUS_ERROR
Detect presence of detail on VD_AGENT_FILE_XFER_STATUS_ERROR and
if the error is supported give more detailed information, otherwise
fallback to the old generic error.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/src/channel-main.c b/src/channel-main.c
index 2dbe46b..e944771 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1912,10 +1912,26 @@ static void main_agent_handle_xfer_status(SpiceMainChannel *channel,
error = g_error_new_literal(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
_("The spice agent cancelled the file transfer"));
break;
- case VD_AGENT_FILE_XFER_STATUS_ERROR:
- error = g_error_new_literal(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
- _("The spice agent reported an error during the file transfer"));
+ case VD_AGENT_FILE_XFER_STATUS_ERROR: {
+ const VDAgentFileXferStatusError *err = (VDAgentFileXferStatusError *) msg->data;
+ if (test_agent_cap(channel, VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS) &&
+ msg_hdr->size >= sizeof(*msg) + sizeof(*err) &&
+ err->error_type == VD_AGENT_FILE_XFER_STATUS_ERROR_GLIB_IO) {
+
+ switch (err->error_code) {
+ case G_IO_ERROR_INVALID_FILENAME:
+ error = g_error_new_literal(G_IO_ERROR, err->error_code,
+ _("Invalid filename of transferred file"));
+ break;
+ }
+ }
+ if (error == NULL) {
+ error = g_error_new_literal(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
+ _("The spice agent reported an error "
+ "during the file transfer"));
+ }
break;
+ }
case VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE: {
const VDAgentFileXferStatusNotEnoughSpace *err =
(VDAgentFileXferStatusNotEnoughSpace*) msg->data;
More information about the Spice-commits
mailing list