Project

General

Profile

0001-Disable-crashhandler-if-coredumps-are-enabled.patch

dalbers, 04/14/2009 11:44 AM

View differences:

src/common/quassel.cpp
22 22

  
23 23
#include <iostream>
24 24
#include <signal.h>
25
#include <sys/resource.h>
25 26

  
26 27
#include <QCoreApplication>
27 28
#include <QDateTime>
......
55 56
  // we have crashhandler for win32 and unix (based on execinfo).
56 57
  // on mac os we use it's integrated backtrace generator
57 58
#if defined(Q_OS_WIN32) || (defined(HAVE_EXECINFO) && !defined(Q_OS_MAC))
58
  signal(SIGABRT, handleSignal);
59
  signal(SIGSEGV, handleSignal);
60
#  ifndef Q_OS_WIN32
61
  signal(SIGBUS, handleSignal);
62
#  endif
59

  
60
  // we only handle crashes ourselves if coredumps are disabled
61
  struct rlimit *limit = (rlimit *) malloc(sizeof(struct rlimit));
62
  int rc = getrlimit(RLIMIT_CORE, limit);
63

  
64
  if ( rc == -1 || !((long)limit->rlim_cur > 0 || limit->rlim_cur == RLIM_INFINITY) ) {
65
    signal(SIGABRT, handleSignal);
66
    signal(SIGSEGV, handleSignal);
67
#   ifndef Q_OS_WIN32
68
    signal(SIGBUS, handleSignal);
69
#   endif
70
  }
71
  free(limit);
72

  
63 73
#endif
64 74
}
65 75

  
66
-