Revert "fixup set rlimit stack failed condition"

This reverts commit bf959371c4.

fixes #6257

refs #6260
This commit is contained in:
Jean Flach 2018-04-25 14:26:40 +02:00 committed by Michael Friedrich
parent 292d71c439
commit c1cb8a8bbe
1 changed files with 23 additions and 24 deletions

View File

@ -258,34 +258,33 @@ void Application::SetResourceLimits(void)
else else
rl.rlim_cur = rl.rlim_max; rl.rlim_cur = rl.rlim_max;
if (setrlimit(RLIMIT_STACK, &rl) < 0) { if (setrlimit(RLIMIT_STACK, &rl) < 0)
Log(LogWarning, "Application") Log(LogWarning, "Application")
<< "Failed adjust resource limit for stack size (RLIMIT_STACK) with error \"" << strerror(errno) << "\""; << "Failed adjust resource limit for stack size (RLIMIT_STACK) with error \"" << strerror(errno) << "\"";
if (set_stack_rlimit) { else if (set_stack_rlimit) {
char **new_argv = static_cast<char **>(malloc(sizeof(char *) * (argc + 2))); char **new_argv = static_cast<char **>(malloc(sizeof(char *) * (argc + 2)));
if (!new_argv) { if (!new_argv) {
perror("malloc"); perror("malloc");
Exit(EXIT_FAILURE); Exit(EXIT_FAILURE);
}
new_argv[0] = argv[0];
new_argv[1] = strdup("--no-stack-rlimit");
if (!new_argv[1]) {
perror("strdup");
exit(1);
}
for (int i = 1; i < argc; i++)
new_argv[i + 1] = argv[i];
new_argv[argc + 1] = NULL;
(void) execvp(new_argv[0], new_argv);
perror("execvp");
_exit(EXIT_FAILURE);
} }
new_argv[0] = argv[0];
new_argv[1] = strdup("--no-stack-rlimit");
if (!new_argv[1]) {
perror("strdup");
exit(1);
}
for (int i = 1; i < argc; i++)
new_argv[i + 1] = argv[i];
new_argv[argc + 1] = NULL;
(void) execvp(new_argv[0], new_argv);
perror("execvp");
_exit(EXIT_FAILURE);
} }
# else /* RLIMIT_STACK */ # else /* RLIMIT_STACK */
Log(LogNotice, "Application", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)"); Log(LogNotice, "Application", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)");