Explorar o código

this [u8] to c_char* is probably wrong

Paul Sajna %!s(int64=7) %!d(string=hai) anos
pai
achega
fc92d95b35
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      platform/src/redox/mod.rs

+ 4 - 1
platform/src/redox/mod.rs

@@ -58,7 +58,10 @@ pub fn ftruncate(fd: c_int, len: off_t) -> {
 pub fn getcwd(buf: *mut c_char, size: size_t) -> {
     // XXX: do something with size maybe
     let rbuf = unsafe { c_str(buf) };
-    syscall::getcwd(rbuf)? as c_int
+    syscall::getcwd(rbuf);
+    unsafe {
+        &*(rbuf as *mut [c_char])
+    }
 }
 
 pub fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {