Add error kind handling for ERROR_PATH_NOT_FOUND

Fixes #29150

Signed-off-by: Peter Atashian <retep998@gmail.com>
This commit is contained in:
Peter Atashian 2015-10-19 00:54:51 -04:00
parent d3f497861d
commit dd11d3c619
3 changed files with 9 additions and 0 deletions

View File

@ -2162,4 +2162,10 @@ mod tests {
}
}
}
#[test]
fn read_dir_not_found() {
let res = fs::read_dir("/path/that/does/not/exist");
assert_eq!(res.err().unwrap().kind(), ErrorKind::NotFound);
}
}

View File

@ -83,6 +83,8 @@ pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
pub const ERROR_PATH_NOT_FOUND: libc::c_int = 3;
#[repr(C)]
#[cfg(target_arch = "x86")]
pub struct WSADATA {

View File

@ -51,6 +51,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
libc::ERROR_ALREADY_EXISTS => ErrorKind::AlreadyExists,
libc::ERROR_BROKEN_PIPE => ErrorKind::BrokenPipe,
libc::ERROR_FILE_NOT_FOUND => ErrorKind::NotFound,
c::ERROR_PATH_NOT_FOUND => ErrorKind::NotFound,
libc::ERROR_NO_DATA => ErrorKind::BrokenPipe,
libc::ERROR_OPERATION_ABORTED => ErrorKind::TimedOut,