Skip to content

Commit fe791d7

Browse files
committed
Use libc errno
1 parent a52da95 commit fe791d7

File tree

1 file changed

+8
-1
lines changed
  • src/libstd/sys/redox

1 file changed

+8
-1
lines changed

src/libstd/sys/redox/os.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@ use vec;
3333
const TMPBUF_SZ: usize = 128;
3434
static ENV_LOCK: Mutex = Mutex::new();
3535

36+
extern {
37+
#[link_name = "__errno_location"]
38+
fn errno_location() -> *mut i32;
39+
}
40+
3641
/// Returns the platform-specific value of errno
3742
pub fn errno() -> i32 {
38-
0
43+
unsafe {
44+
(*errno_location())
45+
}
3946
}
4047

4148
/// Gets a detailed string description for the given error number.

0 commit comments

Comments
 (0)