Re: [PATCH] tests: exit on SIGABRT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 10, 2016 at 04:29:40PM +0000, Frediano Ziglio wrote:
> Fatal error exit usually with abort() causing SIGABRT to be triggered
> which can have problems with core dump generation depending on system
> settings. Capturing and exiting on this signal solve the problem.

I still think this looks like a workaround for an issue elsewhere in the
stack. If the goal is to prevent core dump generation, this deserves a
comment in the code near handle_sigabrt as doing this is very unusual
and seems redundant with what is going to happen when SIGABRT is raised.

Christophe

> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  tests/test-logging.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tests/test-logging.c b/tests/test-logging.c
> index 94e923a..72f35a4 100644
> --- a/tests/test-logging.c
> +++ b/tests/test-logging.c
> @@ -377,11 +377,17 @@ static void test_spice_g_messages_debug_all(void)
>      g_test_trap_assert_stderr("*g_message\n*other_message\n");
>  }
>  
> +static void handle_sigabrt(int sig)
> +{
> +    _Exit(1);
> +}
>  
>  int main(int argc, char **argv)
>  {
>      GLogLevelFlags fatal_mask;
>  
> +    signal(SIGABRT, handle_sigabrt);
> +
>      fatal_mask = (GLogLevelFlags)g_log_set_always_fatal((GLogLevelFlags) G_LOG_FATAL_MASK);
>  
>      g_test_init(&argc, &argv, NULL);
> -- 
> 2.5.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]