summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-07-09 17:55:45 -0400
committerKristian Høgsberg <krh@bitplanet.net>2013-07-09 18:00:00 -0400
commitbecca5fcf7a69e5e7b2d287a8a24d93d9d29fa5a (patch)
treeebde9dec2298d7d558556e78df7bf3900ebf622c
parent12cea9559313c3503a7a321e684e3ef1ec7a6e49 (diff)
wayland-server: Return 0 from read_events() in case of EAGAIN
Getting no data from the socket is not an error condition. This may happen in case of calling prepare_read() and then read_events() with no other pending readers and no data in the socket. In general, read_events() may not queue up events in the given event queue. From a given threads point of view it doesn't matter whether events were read and put in a different event queue or no events were read at all.
-rw-r--r--src/wayland-client.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 45aa372..7bd7f0d 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -873,8 +873,10 @@ read_events(struct wl_display *display)
if (display->reader_count == 0) {
total = wl_connection_read(display->connection);
if (total == -1) {
- if (errno != EAGAIN)
- display_fatal_error(display, errno);
+ if (errno == EAGAIN)
+ return 0;
+
+ display_fatal_error(display, errno);
return -1;
} else if (total == 0) {
/* The compositor has closed the socket. This