summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/native/dalvik_system_ZygoteHooks.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index 4d3ad620cc..8f40dcdeaf 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -76,12 +76,16 @@ static void EnableDebugger() {
}
}
#endif
- // We don't want core dumps, though, so set the core dump size to 0.
+ // We don't want core dumps, though, so set the soft limit on core dump size
+ // to 0 without changing the hard limit.
rlimit rl;
- rl.rlim_cur = 0;
- rl.rlim_max = RLIM_INFINITY;
- if (setrlimit(RLIMIT_CORE, &rl) == -1) {
- PLOG(ERROR) << "setrlimit(RLIMIT_CORE) failed for pid " << getpid();
+ if (getrlimit(RLIMIT_CORE, &rl) == -1) {
+ PLOG(ERROR) << "getrlimit(RLIMIT_CORE) failed for pid " << getpid();
+ } else {
+ rl.rlim_cur = 0;
+ if (setrlimit(RLIMIT_CORE, &rl) == -1) {
+ PLOG(ERROR) << "setrlimit(RLIMIT_CORE) failed for pid " << getpid();
+ }
}
}