qtestcase.cpp: use #ifdef RLIMIT_CORE to guard RLIMIT_CORE usage
Instead of trying to guess which OSes have this functionality. Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc20fe7eca346 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
f7152a4bb7
commit
30067d102c
@ -191,17 +191,17 @@ static bool hasSystemCrashReporter()
|
|||||||
|
|
||||||
static void disableCoreDump()
|
static void disableCoreDump()
|
||||||
{
|
{
|
||||||
|
#ifdef RLIMIT_CORE
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const int disableCoreDump = qEnvironmentVariableIntValue("QTEST_DISABLE_CORE_DUMP", &ok);
|
const int disableCoreDump = qEnvironmentVariableIntValue("QTEST_DISABLE_CORE_DUMP", &ok);
|
||||||
if (ok && disableCoreDump) {
|
if (ok && disableCoreDump) {
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
|
|
||||||
struct rlimit limit;
|
struct rlimit limit;
|
||||||
limit.rlim_cur = 0;
|
limit.rlim_cur = 0;
|
||||||
limit.rlim_max = 0;
|
limit.rlim_max = 0;
|
||||||
if (setrlimit(RLIMIT_CORE, &limit) != 0)
|
if (setrlimit(RLIMIT_CORE, &limit) != 0)
|
||||||
qWarning("Failed to disable core dumps: %d", errno);
|
qWarning("Failed to disable core dumps: %d", errno);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
Q_CONSTRUCTOR_FUNCTION(disableCoreDump);
|
Q_CONSTRUCTOR_FUNCTION(disableCoreDump);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user