Exemple #1
0
static RETSIGTYPE
got_fatal_signal( int sig )
{
    const char *s;

    if( caught_fatal_sig )
	raise( sig );
    caught_fatal_sig = 1;

    secmem_term();

#ifdef HAVE_LIBREADLINE
    rl_free_line_state ();
    rl_cleanup_after_signal ();
#endif
    tty_cleanup_after_signal ();

    /* Better don't translate these messages. */
    write(2, "\n", 1 );
    s = log_get_name(); if( s ) write(2, s, strlen(s) );
    write(2, ": ", 2 );

#if HAVE_DECL_SYS_SIGLIST && defined(NSIG)
    s = (sig >= 0 && sig < NSIG) ? sys_siglist[sig] : "?";
    write (2, s, strlen(s) );
#else
    write (2, "signal ", 7 );
    if (sig < 0 || sig >=100)
        write (2, "?", 1);
    else {
        if (sig >= 10)
            write (2, "0123456789"+(sig/10), 1 );
        write (2, "0123456789"+(sig%10), 1 );
    }
#endif
    write(2, " caught ... exiting\n", 20 );

#ifdef __VMS
    /* 2006-08-10 SMS.
       Restore terminal echo, if needed, before exiting.  */
    vms_set_term_echo (-1);
#endif /* def __VMS */

    /* Reset action to default action and raise signal again. */
    init_one_signal (sig, SIG_DFL, 0);
    dotlock_remove_lockfiles (0);
#ifdef __riscos__
    riscos_close_fds ();
#endif /* __riscos__ */
    raise( sig );
}
Exemple #2
0
static RETSIGTYPE
got_fatal_signal( int sig )
{
    const char *s;

    if( caught_fatal_sig )
	raise( sig );
    caught_fatal_sig = 1;

    gcry_control (GCRYCTL_TERM_SECMEM );

    tty_cleanup_rl_after_signal ();
    tty_cleanup_after_signal ();

    /* Better don't translate these messages. */
    write(2, "\n", 1 );
    s = log_get_name(); if( s ) write(2, s, strlen(s) );
    write(2, ": ", 2 );

#if HAVE_DECL_SYS_SIGLIST && defined(NSIG)
    s = (sig >= 0 && sig < NSIG) ? sys_siglist[sig] : "?";
    write (2, s, strlen(s) );
#else
    write (2, "signal ", 7 );
    if (sig < 0 || sig >=100)
        write (2, "?", 1);
    else {
        if (sig >= 10)
            write (2, "0123456789"+(sig/10), 1 );
        write (2, "0123456789"+(sig%10), 1 );
    }
#endif
    write(2, " caught ... exiting\n", 20 );

    /* Reset action to default action and raise signal again. */
    init_one_signal (sig, SIG_DFL, 0);
    dotlock_remove_lockfiles ();
#ifdef __riscos__
    riscos_close_fds ();
#endif /* __riscos__ */
    raise( sig );
}