Commit 685f9a09 authored by Dipen Somani's avatar Dipen Somani Committed by Derek Foreman

wayland-server: Properly handle EAGAIN from wl_connection_read()

commit 3cddb3c6 casted len to an
unsigned value to compare to sizeof results.  However,
wl_connection_read() can fail, setting errno to EAGAIN and returning
a value of -1.

When cast to an unsigned type this leads to a loop condition of true
when it should be false.
Signed-off-by: default avatarDipen Somani <dipen.somani@samsung.com>
Signed-off-by: default avatarDerek Foreman <derekf@osg.samsung.com>
Reviewed-by: default avatarDerek Foreman <derekf@osg.samsung.com>
parent e09c1a98
......@@ -353,7 +353,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
}
}
while ((size_t) len >= sizeof p) {
while (len >= 0 && (size_t) len >= sizeof p) {
wl_connection_copy(connection, p, sizeof p);
opcode = p[1] & 0xffff;
size = p[1] >> 16;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment