Commit 6da52216 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

restore: set the zero limit for RLIMIT_CORE

This should be done to prevent generating core files, if a process was
killed by SIGSEGV, SIGBUS, etc

https://bugzilla.openvz.org/show_bug.cgi?id=2655

Looks-good-to: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent a18f28d6
......@@ -737,8 +737,13 @@ static int restore_one_zombie(int pid, CoreEntry *core)
}
if (exit_code & 0x7f) {
struct rlimit rlim = {0, 0};
int signr;
/* prevent generating core files */
if (setrlimit(RLIMIT_CORE, &rlim))
pr_perror("Can't set the zero limit for core files");
signr = exit_code & 0x7F;
if (!sig_fatal(signr)) {
pr_warn("Exit with non fatal signal ignored\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment