Skip to content

Commit

Permalink
Revert "fixup set rlimit stack failed condition"
Browse files Browse the repository at this point in the history
This reverts commit bf95937.

fixes #6257

refs #6260
  • Loading branch information
Crunsher authored and Michael Friedrich committed Apr 25, 2018
1 parent 292d71c commit c1cb8a8
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions lib/base/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,34 +258,33 @@ void Application::SetResourceLimits(void)
else
rl.rlim_cur = rl.rlim_max;

if (setrlimit(RLIMIT_STACK, &rl) < 0) {
if (setrlimit(RLIMIT_STACK, &rl) < 0)
Log(LogWarning, "Application")
<< "Failed adjust resource limit for stack size (RLIMIT_STACK) with error \"" << strerror(errno) << "\"";
if (set_stack_rlimit) {
char **new_argv = static_cast<char **>(malloc(sizeof(char *) * (argc + 2)));
else if (set_stack_rlimit) {
char **new_argv = static_cast<char **>(malloc(sizeof(char *) * (argc + 2)));

if (!new_argv) {
perror("malloc");
Exit(EXIT_FAILURE);
}
if (!new_argv) {
perror("malloc");
Exit(EXIT_FAILURE);
}

new_argv[0] = argv[0];
new_argv[1] = strdup("--no-stack-rlimit");
new_argv[0] = argv[0];
new_argv[1] = strdup("--no-stack-rlimit");

if (!new_argv[1]) {
perror("strdup");
exit(1);
}
if (!new_argv[1]) {
perror("strdup");
exit(1);
}

for (int i = 1; i < argc; i++)
new_argv[i + 1] = argv[i];
for (int i = 1; i < argc; i++)
new_argv[i + 1] = argv[i];

new_argv[argc + 1] = NULL;
new_argv[argc + 1] = NULL;

(void) execvp(new_argv[0], new_argv);
perror("execvp");
_exit(EXIT_FAILURE);
}
(void) execvp(new_argv[0], new_argv);
perror("execvp");
_exit(EXIT_FAILURE);
}
# else /* RLIMIT_STACK */
Log(LogNotice, "Application", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)");
Expand Down

0 comments on commit c1cb8a8

Please sign in to comment.