mirror of
https://github.com/swaywm/sway.git
synced 2024-11-11 21:14:10 +01:00
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)
This commit is contained in:
parent
546ddbcd5b
commit
0ab04b7434
@ -386,9 +386,7 @@ void ipc_client_disconnect(struct ipc_client *client) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->fd != -1) {
|
shutdown(client->fd, SHUT_RDWR);
|
||||||
shutdown(client->fd, SHUT_RDWR);
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_log(L_INFO, "IPC Client %d disconnected", client->fd);
|
wlr_log(L_INFO, "IPC Client %d disconnected", client->fd);
|
||||||
wl_event_source_remove(client->event_source);
|
wl_event_source_remove(client->event_source);
|
||||||
@ -468,8 +466,6 @@ void ipc_client_handle_command(struct ipc_client *client) {
|
|||||||
}
|
}
|
||||||
buf[client->payload_length] = '\0';
|
buf[client->payload_length] = '\0';
|
||||||
|
|
||||||
const char *error_denied = "{ \"success\": false, \"error\": \"Permission denied\" }";
|
|
||||||
|
|
||||||
switch (client->current_command) {
|
switch (client->current_command) {
|
||||||
case IPC_COMMAND:
|
case IPC_COMMAND:
|
||||||
{
|
{
|
||||||
@ -650,9 +646,6 @@ void ipc_client_handle_command(struct ipc_client *client) {
|
|||||||
goto exit_cleanup;
|
goto exit_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc_send_reply(client, error_denied, (uint32_t)strlen(error_denied));
|
|
||||||
wlr_log(L_DEBUG, "Denied IPC client access to %i", client->current_command);
|
|
||||||
|
|
||||||
exit_cleanup:
|
exit_cleanup:
|
||||||
client->payload_length = 0;
|
client->payload_length = 0;
|
||||||
free(buf);
|
free(buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user