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

Kristian Høgsberg hoegsberg at gmail.com
Thu Jun 7 13:40:16 PDT 2012


On Thu, Jun 07, 2012 at 02:32:45PM +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.

Should we just make this a local in main() and then set it to
EXIT_FAILURE in the else case of the setjmp if?

Kristian

> Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
> ---
>  src/compositor.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/src/compositor.c b/src/compositor.c
> index 3039c3d..c073d79 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -51,6 +51,7 @@
>  
>  static struct wl_list child_process_list;
>  static jmp_buf segv_jmp_buf;
> +static int weston_return_value = EXIT_SUCCESS;
>  
>  static int
>  sigchld_handler(int signal_number, void *data)
> @@ -3044,6 +3045,7 @@ on_segv_signal(int s, siginfo_t *siginfo, void *context)
>  	int i, count;
>  	Dl_info info;
>  
> +	weston_return_value = EXIT_FAILURE;
>  	fprintf(stderr, "caught segv\n");
>  
>  	count = backtrace(buffer, ARRAY_LENGTH(buffer));
> @@ -3240,5 +3242,5 @@ int main(int argc, char *argv[])
>  	ec->destroy(ec);
>  	wl_display_destroy(display);
>  
> -	return 0;
> +	return weston_return_value;
>  }
> -- 
> 1.7.3.4
> 


More information about the wayland-devel mailing list