aboutsummaryrefslogtreecommitdiff
path: root/sway/ipc.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-08-21 10:56:56 -0400
committerDrew DeVault <sir@cmpwn.com>2015-08-21 10:56:56 -0400
commit034358dbfd07e013417bafcbcc819ddad90a2f21 (patch)
treef31d5042629c27a6fbba0cb73f2b93433dce247a /sway/ipc.c
parent7ecb55f218666ec5c30371eeb9e5982a487fdb4b (diff)
parent8dfaf6265be52a582cc990f4332808d55063766f (diff)
Merge pull request #110 from minus7/sign-comparsion-fix
fixed #108 signed/unsigned comparison
Diffstat (limited to 'sway/ipc.c')
-rw-r--r--sway/ipc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sway/ipc.c b/sway/ipc.c
index 63117def..0b36d758 100644
--- a/sway/ipc.c
+++ b/sway/ipc.c
@@ -121,11 +121,15 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) {
}
int read_available;
- ioctl(client_fd, FIONREAD, &read_available);
+ if (ioctl(client_fd, FIONREAD, &read_available) == -1) {
+ sway_log_errno(L_INFO, "Unable to read IPC socket buffer size");
+ ipc_client_disconnect(client);
+ return 0;
+ }
// Wait for the rest of the command payload in case the header has already been read
if (client->payload_length > 0) {
- if (read_available >= client->payload_length) {
+ if ((uint32_t)read_available >= client->payload_length) {
ipc_client_handle_command(client);
}
else {