summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2015-12-28 14:35:50 +0800
committerJonas Ådahl <jadahl@gmail.com>2016-01-16 16:37:36 +0800
commitc767f35b122737d282125f0b864caf552c21e0eb (patch)
treeb66b3d0f7e1d44c0a5d90d2ce9718f89131c30ec
parent0b44298a15674121ff54585c706bfdefc0d9942a (diff)
downloadwayland-c767f35b122737d282125f0b864caf552c21e0eb.tar.gz
client: Don't make EPIPE fatal if triggered when flushing
If flushing hits EPIPE it should not make it a fatal error since it would make it impossible to process the rest of the data available in the buffer. Instead, let reading the socket make EPIPE fatal, letting the client have the possibility to process the last messages including any error causing the termination. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--src/wayland-client.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 33eb247..69f91a6 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -1498,10 +1498,10 @@ wl_display_dispatch_queue(struct wl_display *display,
return ret;
}
- /* We ignore EPIPE here, so that we try to read events before
- * returning an error. When the compositor sends an error it
- * will close the socket, and if we bail out here we don't get
- * a chance to process the error. */
+ /* We ignore EPIPE here, so that we try to read events before
+ * returning an error. When the compositor sends an error it
+ * will close the socket, and if we bail out here we don't get
+ * a chance to process the error. */
ret = wl_connection_flush(display->connection);
if (ret < 0 && errno != EAGAIN && errno != EPIPE) {
display_fatal_error(display, errno);
@@ -1727,8 +1727,12 @@ wl_display_flush(struct wl_display *display)
errno = display->last_error;
ret = -1;
} else {
+ /* We don't make EPIPE a fatal error here, so that we may try to
+ * read events after the failed flush. When the compositor sends
+ * an error it will close the socket, and if we make EPIPE fatal
+ * here we don't get a chance to process the error. */
ret = wl_connection_flush(display->connection);
- if (ret < 0 && errno != EAGAIN)
+ if (ret < 0 && errno != EAGAIN && errno != EPIPE)
display_fatal_error(display, errno);
}