2
0
Эх сурвалжийг харах

Merge pull request #27 from sajattack/master

add test for errno
Jeremy Soller 7 жил өмнө
parent
commit
633b5474db

+ 1 - 0
include/errno.h

@@ -0,0 +1 @@
+extern int errno;

+ 1 - 0
src/platform/src/lib.rs

@@ -29,6 +29,7 @@ use core::fmt;
 use types::*;
 
 #[thread_local]
+#[no_mangle]
 pub static mut errno: c_int = 0;
 
 pub unsafe fn c_str(s: *const c_char) -> &'static [u8] {

+ 8 - 0
tests/error.c

@@ -0,0 +1,8 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+
+int main(int argc, char** argv) {
+    chdir("nonexistent"); 
+    printf("errno: %d\n", errno);
+}