X-Git-Url: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blobdiff_plain;f=g10%2Fsignal.c;h=2e40af13a57f999f46db642c548187194d5e73fa;hp=44c8a8f2183bda5df2e97fd42097e419380e6d0b;hb=99b1f3e1da894b00006fff3ba601cc0ac2dd524d;hpb=bfc45cc8bc1a2dcdc0d54ac88ff0f7bf3d9c8551 diff --git a/g10/signal.c b/g10/signal.c index 44c8a8f21..2e40af13a 100644 --- a/g10/signal.c +++ b/g10/signal.c @@ -1,6 +1,6 @@ /* signal.c - signal handling - * Copyright (C) 1998, 1999, 2000, 2001, 2003, - * 2004 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, + * 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -16,7 +16,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include @@ -27,7 +28,7 @@ #include #include #include -#ifdef HAVE_READLINE_READLINE_H +#ifdef HAVE_LIBREADLINE #include #include #endif @@ -39,13 +40,16 @@ #include "main.h" #include "ttyio.h" +#ifdef HAVE_DOSISH_SYSTEM +void init_signals(void) {} +void pause_on_sigusr(int which) {} +#else static volatile int caught_fatal_sig = 0; static volatile int caught_sigusr1 = 0; static void init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign ) { -#ifndef HAVE_DOSISH_SYSTEM #if defined(HAVE_SIGACTION) && defined(HAVE_STRUCT_SIGACTION) struct sigaction oact, nact; @@ -69,7 +73,6 @@ init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign ) signal (sig, SIG_IGN); } #endif -#endif /*!HAVE_DOSISH_SYSTEM*/ } static RETSIGTYPE @@ -83,7 +86,7 @@ got_fatal_signal( int sig ) secmem_term(); -#if defined(HAVE_READLINE_READLINE_H) && defined(HAVE_LIBREADLINE) +#ifdef HAVE_LIBREADLINE rl_free_line_state (); rl_cleanup_after_signal (); #endif @@ -93,7 +96,7 @@ got_fatal_signal( int sig ) s = log_get_name(); if( s ) write(2, s, strlen(s) ); write(2, ": ", 2 ); -#if defined(HAVE_DECL_SYS_SIGLIST) && defined(NSIG) +#if HAVE_DECL_SYS_SIGLIST && defined(NSIG) s = (sig >= 0 && sig < NSIG) ? sys_siglist[sig] : "?"; write (2, s, strlen(s) ); #else @@ -128,7 +131,6 @@ got_usr_signal( int sig ) void init_signals() { -#ifndef HAVE_DOSISH_SYSTEM init_one_signal (SIGINT, got_fatal_signal, 1 ); init_one_signal (SIGHUP, got_fatal_signal, 1 ); init_one_signal (SIGTERM, got_fatal_signal, 1 ); @@ -136,14 +138,12 @@ init_signals() init_one_signal (SIGSEGV, got_fatal_signal, 1 ); init_one_signal (SIGUSR1, got_usr_signal, 0 ); init_one_signal (SIGPIPE, SIG_IGN, 0 ); -#endif } void pause_on_sigusr( int which ) { -#ifndef HAVE_DOSISH_SYSTEM #if defined(HAVE_SIGPROCMASK) && defined(HAVE_SIGSET_T) sigset_t mask, oldmask; @@ -164,7 +164,6 @@ pause_on_sigusr( int which ) caught_sigusr1 = 0; sigrelse(SIGUSR1); #endif /*! HAVE_SIGPROCMASK && HAVE_SIGSET_T */ -#endif } /* Disabled - see comment in tdbio.c:tdbio_begin_transaction() */ @@ -172,7 +171,6 @@ pause_on_sigusr( int which ) static void do_block( int block ) { -#ifndef HAVE_DOSISH_SYSTEM static int is_blocked; #if defined(HAVE_SIGPROCMASK) && defined(HAVE_SIGSET_T) static sigset_t oldmask; @@ -222,7 +220,6 @@ do_block( int block ) is_blocked = 0; } #endif /*! HAVE_SIGPROCMASK && HAVE_SIGSET_T */ -#endif /*HAVE_DOSISH_SYSTEM*/ } void @@ -237,3 +234,5 @@ unblock_all_signals() do_block(0); } #endif + +#endif /* !HAVE_DOSISH_SYSTEM */