Diff between a32adc61affd315888401e71dd2aa652c63801dc and 12d882918ebdcf0c993837950758575982f8a379

Changed Files

File Additions Deletions Status
src/shared/mgmt.c +9 -2 modified

Full Patch

diff --git a/src/shared/mgmt.c b/src/shared/mgmt.c
index c41454b..f96897d 100644
--- a/src/shared/mgmt.c
+++ b/src/shared/mgmt.c
@@ -27,6 +27,8 @@
 
 #include <stdio.h>
 #include <unistd.h>
+#include <string.h>
+#include <errno.h>
 
 #include <glib.h>
 
@@ -155,8 +157,13 @@ static gboolean can_write_data(GIOChannel *channel, GIOCondition cond,
 
 	bytes_written = write(mgmt->fd, request->buf, request->len);
 	if (bytes_written < 0) {
-		g_queue_push_head(mgmt->request_queue, request);
-		return FALSE;
+		util_debug(mgmt->debug_callback, mgmt->debug_data,
+				"write failed: %s", strerror(errno));
+		if (request->callback)
+			request->callback(MGMT_STATUS_FAILED, 0, NULL,
+							request->user_data);
+		destroy_request(request, NULL);
+		return TRUE;
 	}
 
 	util_debug(mgmt->debug_callback, mgmt->debug_data,