summaryrefslogtreecommitdiff
path: root/command_service.c
diff options
context:
space:
mode:
Diffstat (limited to 'command_service.c')
-rw-r--r--command_service.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/command_service.c b/command_service.c
index 5d357da..efb350c 100644
--- a/command_service.c
+++ b/command_service.c
@@ -2,6 +2,7 @@
#include "commands.h"
#include <gio/gio.h>
+#include <string.h>
static GSocketService *ss = NULL;
@@ -30,7 +31,16 @@ static gboolean service_incoming(GSocketService *service,
while((eol = g_strstr_len(pos, size, "\n")) != NULL || (eol = g_strstr_len(pos, size, "\r")) != NULL) {
*eol = '\0';
- commands_handle(connection, pos);
+ commands_handle(connection, pos, &error);
+
+ if(error != NULL) {
+ g_warning(error->message);
+ gchar *error_buffer = g_strdup_printf("%s\n", error->message);
+ g_socket_send(socket, error_buffer, strlen(error_buffer), NULL, NULL);
+ g_free(error_buffer);
+ g_error_free(error);
+ error = NULL;
+ }
size -= eol - pos + 1;
pos = eol + 1;