[PATCH weston] compositor: return failure even if SEGV handler works v2

Kristian Høgsberg hoegsberg at gmail.com
Fri Jun 8 10:10:27 PDT 2012


On Fri, Jun 08, 2012 at 05:27:28PM +0300, Pekka Paalanen wrote:
> Weston has a SIGSEGV handler that attempts to shut everything down
> cleanly. If it actually succeeds in that, the process exit status will
> indicate success, when the process just segfaulted.
> 
> Fix that by setting the return value to failure in the SEGV handler.
> 
> v2: use a local instead of a global variable

Thanks,
Kristian

> Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
> ---
>  src/compositor.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/src/compositor.c b/src/compositor.c
> index 220fefb..7e8ebb7 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -3101,6 +3101,7 @@ static const char xdg_error_message[] =
>  
>  int main(int argc, char *argv[])
>  {
> +	int ret = EXIT_SUCCESS;
>  	struct wl_display *display;
>  	struct weston_compositor *ec;
>  	struct wl_event_source *signals[4];
> @@ -3228,6 +3229,8 @@ int main(int argc, char *argv[])
>  	weston_compositor_wake(ec);
>  	if (setjmp(segv_jmp_buf) == 0)
>  		wl_display_run(display);
> +	else
> +		ret = EXIT_FAILURE;
>  
>  	/* prevent further rendering while shutting down */
>  	ec->state = WESTON_COMPOSITOR_SLEEPING;
> @@ -3245,5 +3248,5 @@ int main(int argc, char *argv[])
>  	ec->destroy(ec);
>  	wl_display_destroy(display);
>  
> -	return 0;
> +	return ret;
>  }
> -- 
> 1.7.3.4
> 


More information about the wayland-devel mailing list