[PATCH] wayland-client: Treat EOF when reading the wayland socket as an error

Neil Roberts neil at linux.intel.com
Tue Jul 9 10:58:32 PDT 2013

Bill Spitzak <spitzak at gmail.com> writes:

> Maybe it can abort if ...read_events() is called after an error was 
> encountered. Then bad toolkits will exit, while ones that check for the 
> error state can do something intelligent.

This sounds like a nice idea but it might go a bit wrong if there are
orthogonal bits of code reading the events. For example if the error is
first detected in eglSwapBuffers() then the first time the application
will know about it is when it later calls wl_display_dispatch, but that
will already be the second thing that tries to read the error so it
would abort.

That actually highlights a more serious problem. As soon as the error is
encountered libwayland-client will actually close the socket. That means
that eglSwapBuffers might cause the socket to close without the
application having a chance to know about it. It will then try to poll
on an invalid socket. Or worse still, something might try to open a file
in the interim and end up reusing the file descriptor. Then it would
actually poll on a random unrelated file and completely miss the error!

- Neil
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

More information about the wayland-devel mailing list