this [u8] to c_char* is probably wrong

This commit is contained in:
Paul Sajna
2018-03-04 09:42:57 -08:00
parent 95ed0b59bd
commit fc92d95b35
+4 -1
View File
@@ -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 {