Index: src/timers.c =================================================================== RCS file: /cvsroot/proftp/proftpd/src/timers.c,v retrieving revision 1.37 diff -u -r1.37 timers.c --- src/timers.c 23 May 2011 21:22:24 -0000 1.37 +++ src/timers.c 5 Oct 2011 05:19:53 -0000 @@ -159,18 +159,26 @@ } static RETSIGTYPE sig_alarm(int signo) { +#ifdef SA_INTERRUPT struct sigaction act; act.sa_handler = sig_alarm; sigemptyset(&act.sa_mask); - act.sa_flags = 0; - -#ifdef SA_INTERRUPT - act.sa_flags |= SA_INTERRUPT; -#endif + act.sa_flags = SA_INTERRUPT; /* Install this handler for SIGALRM. */ - sigaction(SIGALRM, &act, NULL); + if (sigaction(SIGALRM, &act, NULL) < 0) { + pr_log_pri(PR_LOG_NOTICE, + "unable to install SIGALRM handler via sigaction(2): %s", + strerror(errno)); + } +#else + if (signal(SIGALRM, sig_alarm) == SIG_ERR) { + pr_log_pri(PR_LOG_NOTICE, + "unable to install SIGALRM handler via signal(3): %s", + strerror(errno)); + } +#endif #ifdef HAVE_SIGINTERRUPT siginterrupt(SIGALRM, 1); @@ -188,17 +196,26 @@ } static void set_sig_alarm(void) { +#ifdef SA_INTERRUPT struct sigaction act; act.sa_handler = sig_alarm; sigemptyset(&act.sa_mask); - act.sa_flags = 0; -#ifdef SA_INTERRUPT - act.sa_flags |= SA_INTERRUPT; -#endif + act.sa_flags = SA_INTERRUPT; /* Install this handler for SIGALRM. */ - sigaction(SIGALRM, &act, NULL); + if (sigaction(SIGALRM, &act, NULL) < 0) { + pr_log_pri(PR_LOG_NOTICE, + "unable to install SIGALRM handler via sigaction(2): %s", + strerror(errno)); + } +#else + if (signal(SIGALRM, sig_alarm) == SIG_ERR) { + pr_log_pri(PR_LOG_NOTICE, + "unable to install SIGALRM handler via signal(3): %s", + strerror(errno)); + } +#endif #ifdef HAVE_SIGINTERRUPT siginterrupt(SIGALRM, 1);