From: Daniel Albers Date: Mon, 18 May 2009 22:29:33 +0000 (+0200) Subject: Disable crashhandler if coredumps are enabled X-Git-Tag: 0.4.2~2 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=fb60aceb5dfb0305e363b59c7b207dc0e9beee6f Disable crashhandler if coredumps are enabled Fixes #673. --- diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index b6b2e7a1..20754afc 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -22,6 +22,9 @@ #include #include +#if !defined Q_OS_WIN32 && !defined Q_OS_MAC +# include +#endif #include #include @@ -55,11 +58,22 @@ Quassel::Quassel() { // we have crashhandler for win32 and unix (based on execinfo). // on mac os we use it's integrated backtrace generator #if defined(Q_OS_WIN32) || (defined(HAVE_EXECINFO) && !defined(Q_OS_MAC)) - signal(SIGABRT, handleSignal); - signal(SIGSEGV, handleSignal); -# ifndef Q_OS_WIN32 - signal(SIGBUS, handleSignal); -# endif + +# ifndef Q_OS_WIN32 + // we only handle crashes ourselves if coredumps are disabled + struct rlimit *limit = (rlimit *) malloc(sizeof(struct rlimit)); + int rc = getrlimit(RLIMIT_CORE, limit); + + if(rc == -1 || !((long)limit->rlim_cur > 0 || limit->rlim_cur == RLIM_INFINITY)) { +# endif + signal(SIGABRT, handleSignal); + signal(SIGSEGV, handleSignal); +# ifndef Q_OS_WIN32 + signal(SIGBUS, handleSignal); + } + free(limit); +# endif + #endif }