diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-02-18 17:18:57 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-12-04 22:22:05 +0100 |
commit | faac92a4cb2ac06ea998987fb3ce53882b9e1970 (patch) | |
tree | 882afc22d50e6ba318bddfe5588947c005ad293e /gobex/gobex-transfer.c | |
parent | 9e1e47425e1eea7f6300a653fae62ce8ca435eca (diff) | |
download | bluez-faac92a4cb2ac06ea998987fb3ce53882b9e1970.tar.gz |
gobex: Translate posix error code to proper OBEX response opcode
This patch create a map between posix errors code and OBEX response
opcode and use it to generate a proper response in case a transfer
failed instead of always responding with internal error.
Diffstat (limited to 'gobex/gobex-transfer.c')
-rw-r--r-- | gobex/gobex-transfer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gobex/gobex-transfer.c b/gobex/gobex-transfer.c index a779e4f67..c62a91ec2 100644 --- a/gobex/gobex-transfer.c +++ b/gobex/gobex-transfer.c @@ -501,6 +501,7 @@ static gssize get_get_data(void *buf, gsize len, gpointer user_data) GObexPacket *req, *rsp; GError *err = NULL; gssize ret; + guint8 op; g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", transfer->id); @@ -530,8 +531,9 @@ static gssize get_get_data(void *buf, gsize len, gpointer user_data) return ret; } - req = g_obex_packet_new(G_OBEX_RSP_INTERNAL_SERVER_ERROR, TRUE, - G_OBEX_HDR_INVALID); + op = g_obex_errno_to_rsp(ret); + + req = g_obex_packet_new(op, TRUE, G_OBEX_HDR_INVALID); g_obex_send(transfer->obex, req, NULL); err = g_error_new(G_OBEX_ERROR, G_OBEX_ERROR_CANCELLED, |