X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fquassel.cpp;h=33b6cbd4c9bc2267df6441ac44a3aca8a16841a6;hb=0a1c1ff4f99a7eb53ff6cdd95ce5d7ac263e77d2;hp=08652abe1ebb17db50097635ef76f1913ae23847;hpb=ace46ddca3818d63d8de9ff481038bda8f5cf982;p=quassel.git diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index 08652abe..33b6cbd4 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -20,7 +20,11 @@ #include "quassel.h" +#include #include +#if !defined Q_OS_WIN32 && !defined Q_OS_MAC +# include +#endif #include #include @@ -54,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 } @@ -84,6 +99,11 @@ bool Quassel::init() { return false; } + if(isOptionSet("version")) { + std::cout << qPrintable("Quassel IRC: " + Quassel::buildInfo().plainVersionString) << std::endl; + return false; + } + DEBUG = isOptionSet("debug"); return true; }