Skip to content

Commit

Permalink
Don't set rlimit to a lower value than the current
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Aug 9, 2018
1 parent 39e9516 commit 6563803
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_driver/lib.rs
Expand Up @@ -1512,7 +1512,7 @@ pub fn in_named_rustc_thread<F, R>(name: String, f: F) -> Result<R, Box<dyn Any
true
} else if rlim.rlim_max < STACK_SIZE as libc::rlim_t {
true
} else {
} else if rlim.rlim_cur < STACK_SIZE as libc::rlim_t {
std::rt::deinit_stack_guard();
rlim.rlim_cur = STACK_SIZE as libc::rlim_t;
if libc::setrlimit(libc::RLIMIT_STACK, &mut rlim) != 0 {
Expand All @@ -1524,6 +1524,8 @@ pub fn in_named_rustc_thread<F, R>(name: String, f: F) -> Result<R, Box<dyn Any
std::rt::update_stack_guard();
false
}
} else {
false
}
};

Expand Down

0 comments on commit 6563803

Please sign in to comment.