Explorar o código

Fix Redox fchdir

Jeremy Soller %!s(int64=5) %!d(string=hai) anos
pai
achega
06bab2aa81
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      src/platform/redox/mod.rs

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

@@ -283,11 +283,12 @@ impl Pal for Sys {
     }
 
     fn fchdir(fd: c_int) -> c_int {
-        let path: &mut [u8] = &mut [0; 4096];
-        if e(syscall::fpath(fd as usize, path)) == !0 {
+        let mut buf = [0; 4096];
+        let res = e(syscall::fpath(fd as usize, &mut buf));
+        if res == !0 {
             !0
         } else {
-            e(syscall::chdir(path)) as c_int
+            e(syscall::chdir(&buf[..res])) as c_int
         }
     }