From fe791d78866941da4996e14b43706fead913b447 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 20 Jan 2017 18:44:36 -0700 Subject: [PATCH] Use libc errno --- src/libstd/sys/redox/os.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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.