about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-08-09 19:38:41 +0100
committervarkor <github@varkor.com>2018-08-09 19:38:41 +0100
commit6563803ed3ea02d48ad9d853bad502633ae970af (patch)
tree4a5ec1a17511893c91b13b03e95ebcafa6f847b9
parent39e95165323f76042dfab65772a8411dd85fe088 (diff)
downloadrust-6563803ed3ea02d48ad9d853bad502633ae970af.tar.gz
rust-6563803ed3ea02d48ad9d853bad502633ae970af.zip
Don't set rlimit to a lower value than the current
-rw-r--r--src/librustc_driver/lib.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 556ee9f5716..f34c4158923 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -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 {
@@ -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
         }
     };