Use unsigned return values in read()-like Pal fns.
Returning a negative number of bytes makes absolutely no sense, besides the "-1 and errno" pattern, which is now converted to Result<_, Errno>.
This commit is contained in:
@@ -986,7 +986,9 @@ pub unsafe extern "C" fn realpath(pathname: *const c_char, resolved: *mut c_char
|
||||
|
||||
let len = out.len();
|
||||
// TODO: better error handling
|
||||
let read = Sys::fpath(*file, &mut out[..len - 1]).or_minus_one_errno();
|
||||
let read = Sys::fpath(*file, &mut out[..len - 1])
|
||||
.map(|read| read as ssize_t)
|
||||
.or_minus_one_errno();
|
||||
if read < 0 {
|
||||
return ptr::null_mut();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user