]> git.lizzy.rs Git - rust.git/commitdiff
Don't set rlimit to a lower value than the current
authorvarkor <github@varkor.com>
Thu, 9 Aug 2018 18:38:41 +0000 (19:38 +0100)
committervarkor <github@varkor.com>
Thu, 9 Aug 2018 18:38:41 +0000 (19:38 +0100)
src/librustc_driver/lib.rs

index 556ee9f5716ea32c9849b8f33af0af4e39573edc..f34c4158923d660fa453a52acd3d985cd0298c64 100644 (file)
@@ -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
         }
     };