diff options
Diffstat (limited to 'devices/src/virtio/wl.rs')
-rw-r--r-- | devices/src/virtio/wl.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/devices/src/virtio/wl.rs b/devices/src/virtio/wl.rs index d21fa35..12f5012 100644 --- a/devices/src/virtio/wl.rs +++ b/devices/src/virtio/wl.rs @@ -316,7 +316,7 @@ enum WlError { NewAlloc(Error), NewPipe(Error), AllocSetSize(Error), - SocketConnect(io::Error), + SocketConnect { path: PathBuf, inner: io::Error }, SocketNonBlock(io::Error), VmControl(MsgError), VmBadResponse, @@ -342,7 +342,9 @@ impl Display for WlError { NewAlloc(e) => write!(f, "failed to create shared memory allocation: {}", e), NewPipe(e) => write!(f, "failed to create pipe: {}", e), AllocSetSize(e) => write!(f, "failed to set size of shared memory: {}", e), - SocketConnect(e) => write!(f, "failed to connect socket: {}", e), + SocketConnect { path, inner } => { + write!(f, "failed to connect socket at {:?}: {}", path, inner) + } SocketNonBlock(e) => write!(f, "failed to set socket as non-blocking: {}", e), VmControl(e) => write!(f, "failed to control parent VM: {}", e), VmBadResponse => write!(f, "invalid response from parent VM"), @@ -600,7 +602,11 @@ impl fmt::Debug for WlVfd { impl WlVfd { fn connect<P: AsRef<Path>>(path: P) -> WlResult<WlVfd> { - let socket = UnixStream::connect(path).map_err(WlError::SocketConnect)?; + let path = path.as_ref(); + let socket = UnixStream::connect(path).map_err(|e| WlError::SocketConnect { + path: path.to_path_buf(), + inner: e, + })?; let mut vfd = WlVfd::default(); vfd.socket = Some(socket); Ok(vfd) |