Print error on sigsegv even when backtrace is not supported

git-svn: trunk@1525
remotes/push_mirror/metadata
Nigel Horne 20 years ago
parent 6b1dd3efb7
commit 92fbb0d6b6
  1. 1
      clamav-devel/clamav-milter/INSTALL
  2. 17
      clamav-devel/clamav-milter/clamav-milter.c

@ -765,6 +765,7 @@ Changes
0.84f 4/5/05: Better handling of open failures for LogFile
Always send 451 when reloading a database, even if
dont-wait isn't set
0.84g 9/5/05: Print an error in the log if a segfault is received
4. INTERNATIONALISATION

@ -22,9 +22,9 @@
*
* For installation instructions see the file INSTALL that came with this file
*/
static char const rcsid[] = "$Id: clamav-milter.c,v 1.197 2005/05/06 17:55:50 nigelhorne Exp $";
static char const rcsid[] = "$Id: clamav-milter.c,v 1.198 2005/05/09 17:02:26 nigelhorne Exp $";
#define CM_VERSION "0.84f"
#define CM_VERSION "0.84g"
#if HAVE_CONFIG_H
#include "clamav-config.h"
@ -441,10 +441,11 @@ static const char *pidfile;
#endif
#endif
static void sigsegv(int sig);
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
static void sigsegv(int sig);
static void print_trace(void);
#define BACKTRACE_SIZE 200
@ -1550,9 +1551,7 @@ main(int argc, char **argv)
pthread_mutex_unlock(&version_mutex);
#endif
#ifdef HAVE_BACKTRACE
(void)signal(SIGSEGV, sigsegv);
#endif
return smfi_main();
}
@ -4911,19 +4910,23 @@ loadDatabase(void)
return cl_statinidir(dbdir, &dbstat);
}
#ifdef HAVE_BACKTRACE
static void
sigsegv(int sig)
{
signal(SIGSEGV, SIG_DFL);
#ifdef HAVE_BACKTRACE
print_trace();
#endif
if(use_syslog)
syslog(LOG_ERR, "Segmentation fault :-( Bye..");
cli_dbgmsg("Segmentation fault :-( Bye..\n");
cli_errmsg("Segmentation fault :-( Bye..\n");
smfi_stop();
}
#ifdef HAVE_BACKTRACE
static void
print_trace(void)
{

Loading…
Cancel
Save