From 4c3dec8abfde7e16494b552a4a777ef28866dc40 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Wed, 10 Oct 2012 20:34:58 -0300 Subject: [PATCH] gattrib: Fix ignoring the error message when write fails If an error happens during writing to the socket, we should complain that it failed. --- attrib/gattrib.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/attrib/gattrib.c b/attrib/gattrib.c index 6f6942fb6..080610125 100644 --- a/attrib/gattrib.c +++ b/attrib/gattrib.c @@ -313,8 +313,14 @@ static gboolean can_write_data(GIOChannel *io, GIOCondition cond, iostat = g_io_channel_write_chars(io, (gchar *) cmd->pdu, cmd->len, &len, &gerr); - if (iostat != G_IO_STATUS_NORMAL) + if (iostat != G_IO_STATUS_NORMAL) { + if (gerr) { + error("%s", gerr->message); + g_error_free(gerr); + } + return FALSE; + } if (cmd->expected == 0) { g_queue_pop_head(queue); -- 2.47.3