display_dispatch: Terminate poll loop on EPIPE
display_dispatch tried to flush the display in a loop until it no longer returns an error that is EAGAIN or EPIPE. This becomes an infinite loop if the socket is closed. Stop flushing if we hit EPIPE, as the connection is dead. We still try to read what we were sent to the protocol error shows up in debug output.master
parent
cee422b440
commit
cc9251d5c3
6
main.c
6
main.c
|
@ -634,8 +634,10 @@ static int display_dispatch(struct wl_display *display, int timeout) {
|
||||||
pfd[1].fd = timer_signal_fds[0];
|
pfd[1].fd = timer_signal_fds[0];
|
||||||
|
|
||||||
pfd[0].events = POLLOUT;
|
pfd[0].events = POLLOUT;
|
||||||
while (wl_display_flush(display) == -1) {
|
// If we hit EPIPE we might have hit a protocol error. Continue reading
|
||||||
if (errno != EAGAIN && errno != EPIPE) {
|
// so that we can see what happened.
|
||||||
|
while (wl_display_flush(display) == -1 && errno != EPIPE) {
|
||||||
|
if (errno != EAGAIN) {
|
||||||
wl_display_cancel_read(display);
|
wl_display_cancel_read(display);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue