mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
vm-virtio: Fix map_err losing the inner error
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
4587cc7ffa
commit
0a7bcc9a7d
@ -28,12 +28,18 @@ mod defs {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
/// Error converting from UTF-8
|
||||
ConvertFromUTF8(std::str::Utf8Error),
|
||||
/// Error registering a new epoll-listening FD.
|
||||
EpollAdd(std::io::Error),
|
||||
/// Error creating an epoll FD.
|
||||
EpollFdCreate(std::io::Error),
|
||||
/// The host made an invalid vsock port connection request.
|
||||
InvalidPortRequest,
|
||||
/// Error parsing integer.
|
||||
ParseInteger(std::num::ParseIntError),
|
||||
/// Error reading stream port.
|
||||
ReadStreamPort(Box<Error>),
|
||||
/// Error accepting a new connection from the host-side Unix socket.
|
||||
UnixAccept(std::io::Error),
|
||||
/// Error binding to the host-side Unix socket.
|
||||
|
@ -452,7 +452,7 @@ impl VsockMuxer {
|
||||
}
|
||||
|
||||
let mut word_iter = std::str::from_utf8(&buf[..blen])
|
||||
.map_err(|_| Error::InvalidPortRequest)?
|
||||
.map_err(Error::ConvertFromUTF8)?
|
||||
.split_whitespace();
|
||||
|
||||
word_iter
|
||||
@ -466,8 +466,8 @@ impl VsockMuxer {
|
||||
}
|
||||
})
|
||||
.and_then(|_| word_iter.next().ok_or(Error::InvalidPortRequest))
|
||||
.and_then(|word| word.parse::<u32>().map_err(|_| Error::InvalidPortRequest))
|
||||
.map_err(|_| Error::InvalidPortRequest)
|
||||
.and_then(|word| word.parse::<u32>().map_err(Error::ParseInteger))
|
||||
.map_err(|e| Error::ReadStreamPort(Box::new(e)))
|
||||
}
|
||||
|
||||
/// Add a new connection to the active connection pool.
|
||||
|
Loading…
x
Reference in New Issue
Block a user