diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs index 4a22717523b69b2fc1bf2915eb219ed113624e32..1028478d461d3130a953979f26204d76b48a7f42 100644 --- a/src/platform/redox/mod.rs +++ b/src/platform/redox/mod.rs @@ -894,26 +894,10 @@ impl Pal for Sys { } fn readlink(pathname: &CStr, out: &mut [u8]) -> ssize_t { - let file = match File::open( - pathname, - fcntl::O_PATH | fcntl::O_SYMLINK | fcntl::O_CLOEXEC, - ) { - Ok(ok) => ok, + match File::open(pathname, fcntl::O_RDONLY | fcntl::O_SYMLINK | fcntl::O_CLOEXEC) { + Ok(file) => Self::read(*file, out), Err(_) => return -1, - }; - - if out.is_empty() { - return 0; } - - let len = out.len(); - let read = e(syscall::fpath(*file as usize, &mut out[..len - 1])); - if (read as c_int) < 0 { - return -1; - } - out[read as usize] = 0; - - 0 } fn rename(oldpath: &CStr, newpath: &CStr) -> c_int {