diff options
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r-- | sway/ipc-server.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 8cfd9f26..abdaa237 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -64,6 +64,10 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) { | |||
64 | close(ipc_socket); | 64 | close(ipc_socket); |
65 | unlink(ipc_sockaddr->sun_path); | 65 | unlink(ipc_sockaddr->sun_path); |
66 | 66 | ||
67 | while (ipc_client_list->length) { | ||
68 | struct ipc_client *client = ipc_client_list->items[0]; | ||
69 | ipc_client_disconnect(client); | ||
70 | } | ||
67 | list_free(ipc_client_list); | 71 | list_free(ipc_client_list); |
68 | 72 | ||
69 | if (ipc_sockaddr) { | 73 | if (ipc_sockaddr) { |
@@ -479,10 +483,10 @@ void ipc_client_handle_command(struct ipc_client *client) { | |||
479 | case IPC_COMMAND: | 483 | case IPC_COMMAND: |
480 | { | 484 | { |
481 | struct cmd_results *results = execute_command(buf, NULL); | 485 | struct cmd_results *results = execute_command(buf, NULL); |
482 | const char *json = cmd_results_to_json(results); | 486 | char *json = cmd_results_to_json(results); |
483 | char reply[256]; | 487 | int length = strlen(json); |
484 | int length = snprintf(reply, sizeof(reply), "%s", json); | 488 | client_valid = ipc_send_reply(client, json, (uint32_t)length); |
485 | client_valid = ipc_send_reply(client, reply, (uint32_t)length); | 489 | free(json); |
486 | free_cmd_results(results); | 490 | free_cmd_results(results); |
487 | goto exit_cleanup; | 491 | goto exit_cleanup; |
488 | } | 492 | } |