about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-01-25 17:08:16 +0100
committerGitHub <noreply@github.com>2017-01-25 17:08:16 +0100
commitfd8988eb0b3120c6a71bb86f0c5ecec0d4ce37f0 (patch)
tree1470cbf2fe079d1699df15a4393a77dd4148725d /src/libstd
parent6ca35a6e18e0e42a1667d3a99cf03090db27b312 (diff)
parentfe791d78866941da4996e14b43706fead913b447 (diff)
downloadrust-fd8988eb0b3120c6a71bb86f0c5ecec0d4ce37f0.tar.gz
rust-fd8988eb0b3120c6a71bb86f0c5ecec0d4ce37f0.zip
Rollup merge of #39212 - redox-os:master, r=brson
Use libc errno in Redox submodule

This fixes https://github.com/redox-os/redox/issues/830, and is necessary when using libc in Redox
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/sys/redox/os.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs
index 135e972bca4..9d459581dd4 100644
--- a/src/libstd/sys/redox/os.rs
+++ b/src/libstd/sys/redox/os.rs
@@ -33,9 +33,16 @@ use vec;
 const TMPBUF_SZ: usize = 128;
 static ENV_LOCK: Mutex = Mutex::new();
 
+extern {
+    #[link_name = "__errno_location"]
+    fn errno_location() -> *mut i32;
+}
+
 /// Returns the platform-specific value of errno
 pub fn errno() -> i32 {
-    0
+    unsafe {
+        (*errno_location())
+    }
 }
 
 /// Gets a detailed string description for the given error number.