[Patch] weston-launch: Fix tight poll/recvmsg loop on weston exit

Bruno Prémont bonbons at linux-vserver.org
Fri Mar 27 05:34:35 PDT 2015


When weston fails to run while being launched by weston-launch it's
socketpair causes poll() to notify POLLIN|POLLHUP and lets recvmsg()
return 0.

Properly cleanup and exit in that case instead of poll()ing in a tight
loop and leaving tty in graphics mode if we get SIGKILLed as only way
out.

This happens only when weston-launch (and weston) are being traced
as in `strace -f weston-launch` as then signalfd is not passing the
SIGCHLD signal.

Signed-off-by: Bruno Prémont <bonbons at linux-vserver.org>
---
--- a/src/weston-launch.c	2015-03-01 18:46:27.289835438 +0100
+++ b/src/weston-launch.c	2015-03-01 18:46:24.599835453 +0100
@@ -771,6 +771,8 @@ main(int argc, char *argv[])
 			error(0, errno, "poll failed");
 		if (fds[0].revents & POLLIN)
 			handle_socket_msg(&wl);
+		if (fds[0].revents & POLLHUP)
+			quit(&wl, 0);
 		if (fds[1].revents)
 			handle_signal(&wl);
 	}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 648 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150327/b225f36f/attachment.sig>


More information about the wayland-devel mailing list