Skip to content

Commit fd8988e

Browse files
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
2 parents 6ca35a6 + fe791d7 commit fd8988e

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)