about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-07-16 11:59:53 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-07-21 09:18:30 -0700
commitd68b152c3e2feb6ee18bdf2c992098376dbb528c (patch)
tree535bd20cf5b0c241227ab828a8580f2bd1ab38d2 /src/libstd/rt
parent39d4faf989cea236e2e1669ab85d060d1c62cd85 (diff)
downloadrust-d68b152c3e2feb6ee18bdf2c992098376dbb528c.tar.gz
rust-d68b152c3e2feb6ee18bdf2c992098376dbb528c.zip
std: Be resilient to failure in pthread_getattr_np
This can fail on linux for various reasons, such as the /proc filesystem not
being mounted. There are already many cases where we can't set up stack guards,
so just don't worry about this case and communicate that no guard was enabled.

I've confirmed that this allows the compiler to run in a chroot without /proc
mounted.

Closes #22642
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index 1729d20da20..0ac0d03e19d 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -96,7 +96,7 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
         // own fault handlers if we hit it.
         sys_common::stack::record_os_managed_stack_bounds(my_stack_bottom,
                                                           my_stack_top);
-        sys::thread::guard::init();
+        let main_guard = sys::thread::guard::init();
         sys::stack_overflow::init();
 
         // Next, set up the current Thread with the guard information we just
@@ -104,7 +104,7 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
         // but we just do this to name the main thread and to give it correct
         // info about the stack bounds.
         let thread: Thread = NewThread::new(Some("<main>".to_string()));
-        thread_info::set(sys::thread::guard::main(), thread);
+        thread_info::set(main_guard, thread);
 
         // By default, some platforms will send a *signal* when a EPIPE error
         // would otherwise be delivered. This runtime doesn't install a SIGPIPE