Skip to content

Commit 6563803

Browse files
committed
Don't set rlimit to a lower value than the current
1 parent 39e9516 commit 6563803

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustc_driver/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@ pub fn in_named_rustc_thread<F, R>(name: String, f: F) -> Result<R, Box<dyn Any
15121512
true
15131513
} else if rlim.rlim_max < STACK_SIZE as libc::rlim_t {
15141514
true
1515-
} else {
1515+
} else if rlim.rlim_cur < STACK_SIZE as libc::rlim_t {
15161516
std::rt::deinit_stack_guard();
15171517
rlim.rlim_cur = STACK_SIZE as libc::rlim_t;
15181518
if libc::setrlimit(libc::RLIMIT_STACK, &mut rlim) != 0 {
@@ -1524,6 +1524,8 @@ pub fn in_named_rustc_thread<F, R>(name: String, f: F) -> Result<R, Box<dyn Any
15241524
std::rt::update_stack_guard();
15251525
false
15261526
}
1527+
} else {
1528+
false
15271529
}
15281530
};
15291531

0 commit comments

Comments
 (0)