aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-06-30 17:03:45 +0900
committerLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-07-02 08:03:41 +0900
commit0ab04b7434306c5faceda2b4d2922e9d78de0184 (patch)
treef4d8d06f9aaeb3d75bf1dfc2676835d5c97abb24 /sway/ipc-server.c
parentipc-server: fix double-free on send error in ipc_send_event (diff)
downloadsway-0ab04b7434306c5faceda2b4d2922e9d78de0184.tar.gz
sway-0ab04b7434306c5faceda2b4d2922e9d78de0184.tar.zst
sway-0ab04b7434306c5faceda2b4d2922e9d78de0184.zip
ipc-server: minor code cleanup
No logic change here, this one is mostly to please static analyzer: - client->fd can never be -1 (and if it could, close() a few lines below would have needed the same check) - we never send permission denied error (dead code)
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index ec933ec3..2dfe2d03 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -386,9 +386,7 @@ void ipc_client_disconnect(struct ipc_client *client) {
386 return; 386 return;
387 } 387 }
388 388
389 if (client->fd != -1) { 389 shutdown(client->fd, SHUT_RDWR);
390 shutdown(client->fd, SHUT_RDWR);
391 }
392 390
393 wlr_log(L_INFO, "IPC Client %d disconnected", client->fd); 391 wlr_log(L_INFO, "IPC Client %d disconnected", client->fd);
394 wl_event_source_remove(client->event_source); 392 wl_event_source_remove(client->event_source);
@@ -468,8 +466,6 @@ void ipc_client_handle_command(struct ipc_client *client) {
468 } 466 }
469 buf[client->payload_length] = '\0'; 467 buf[client->payload_length] = '\0';
470 468
471 const char *error_denied = "{ \"success\": false, \"error\": \"Permission denied\" }";
472
473 switch (client->current_command) { 469 switch (client->current_command) {
474 case IPC_COMMAND: 470 case IPC_COMMAND:
475 { 471 {
@@ -650,9 +646,6 @@ void ipc_client_handle_command(struct ipc_client *client) {
650 goto exit_cleanup; 646 goto exit_cleanup;
651 } 647 }
652 648
653 ipc_send_reply(client, error_denied, (uint32_t)strlen(error_denied));
654 wlr_log(L_DEBUG, "Denied IPC client access to %i", client->current_command);
655
656exit_cleanup: 649exit_cleanup:
657 client->payload_length = 0; 650 client->payload_length = 0;
658 free(buf); 651 free(buf);