mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-02-22 06:50:38 +01:00
Send the trailing null byte for composed string messages
The iobuf treats this as binary data but then we're using it as strings in the message parsing code. So make sure all messages have a trailing null byte. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
1817071b5a
commit
8ec0f4bf7c
2 changed files with 6 additions and 6 deletions
|
|
@ -222,7 +222,7 @@ connection_send_connect(struct ei *ei)
|
|||
ei->name ? ei->name : "unnamed"))
|
||||
return -ENOMEM;
|
||||
|
||||
return min(0, xwrite(source_get_fd(ei->source), buf, strlen(buf)));
|
||||
return min(0, xwrite(source_get_fd(ei->source), buf, strlen(buf) + 1));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -246,7 +246,7 @@ connection_send_add(struct ei *ei, struct ei_device *device)
|
|||
if (!xsnprintf(buf, sizeof(buf), "add %d %d\n", device->id, device->capabilities))
|
||||
return -ENOMEM;
|
||||
|
||||
return min(0, xwrite(source_get_fd(ei->source), buf, strlen(buf)));
|
||||
return min(0, xwrite(source_get_fd(ei->source), buf, strlen(buf) + 1));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -260,7 +260,7 @@ connection_send_remove(struct ei *ei, struct ei_device *device)
|
|||
if (!xsnprintf(buf, sizeof(buf), "remove %d\n", device->id))
|
||||
return -ENOMEM;
|
||||
|
||||
return min(0, xwrite(source_get_fd(ei->source), buf, strlen(buf)));
|
||||
return min(0, xwrite(source_get_fd(ei->source), buf, strlen(buf) + 1));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -274,7 +274,7 @@ connection_send_rel(struct ei *ei, struct ei_device *device, int32_t x, int32_t
|
|||
if (!xsnprintf(buf, sizeof(buf), "rel %d %d %d\n", device->id, x, y))
|
||||
return -ENOMEM;
|
||||
|
||||
return min(0, xwrite(source_get_fd(ei->source), buf, strlen(buf)));
|
||||
return min(0, xwrite(source_get_fd(ei->source), buf, strlen(buf) + 1));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ client_send_accepted(struct eis_client *client, struct eis_device *device)
|
|||
if (!xsnprintf(buf, sizeof(buf), "accept %d\n", device->id))
|
||||
return -ENOMEM;
|
||||
|
||||
return min(0, xwrite(source_get_fd(client->source), buf, strlen(buf)));
|
||||
return min(0, xwrite(source_get_fd(client->source), buf, strlen(buf) + 1));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -152,7 +152,7 @@ client_send_removed(struct eis_client *client, struct eis_device *device)
|
|||
if (!xsnprintf(buf, sizeof(buf), "remove %d\n", device->id))
|
||||
return -ENOMEM;
|
||||
|
||||
return min(0, xwrite(source_get_fd(client->source), buf, strlen(buf)));
|
||||
return min(0, xwrite(source_get_fd(client->source), buf, strlen(buf) + 1));
|
||||
}
|
||||
|
||||
_public_ void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue