compositor: leave no zombie behind
compositor: leave no zombie behind

When SIGCHLD fires, we may have more than one zombie to be collected.
Run waitpid() in a loop until no more zombies are found, and clean them
all up.

It looks like the SIGCHLD signalfd does not trigger again for remaining
zombies, so we need the loop.

This works around a crash in text_backend_notified_destroy, which ends
up using stale input_method.client if the sigchld handler is not called.
The crash could be triggered by removing both weston-desktop-shell and
weston-keyboard, so that both would try to respawn and give up, and then
quitting Weston.

Cc: f940f1edd39b53102147818837cffd2a3b576448@gmail.com
Cc: Boyan Ding <53c2f6a61c0fa7f115ecc08b03fdb6b52482ccbc@126.com>
Cc: Derek Foreman <2f97e0f0bc172406aab8ccd42dab54c95bab8759@osg.samsung.com>
Signed-off-by: Pekka Paalanen <0f6ae7001e34c37b02fb2c1c2573ddf8f442136a@collabora.co.uk>
Reviewed-by: Derek Foreman <2f97e0f0bc172406aab8ccd42dab54c95bab8759@osg.samsung.com>

giucam/weston,udoprog/weston,sir-murray/weston,mchalupa/weston,kwm81/weston,krezovic/weston,Gnurou/weston,giucam/weston,krezovic/weston,eyolfson/weston,sir-murray/weston,Tarnyko/weston-xdg_surface_present,udoprog/weston,xorgy/weston,Gnurou/weston,Fantu/compositor-spice,kwm81/weston,eyolfson/weston,Fantu/compositor-spice,mchalupa/weston,Fantu/compositor-spice,Tarnyko/weston-xdg_surface_present,jonnylamb/weston,jonnylamb/weston,xorgy/weston