@@ -133,29 +133,31 @@ pub use crate::sys::android::signal;
133133pub use libc:: signal;
134134
135135pub fn decode_error_kind ( errno : i32 ) -> ErrorKind {
136+ use ErrorKind :: * ;
136137 match errno as libc:: c_int {
137- libc:: ECONNREFUSED => ErrorKind :: ConnectionRefused ,
138- libc:: ECONNRESET => ErrorKind :: ConnectionReset ,
139- libc:: EPERM | libc:: EACCES => ErrorKind :: PermissionDenied ,
140- libc:: EPIPE => ErrorKind :: BrokenPipe ,
141- libc:: ENOTCONN => ErrorKind :: NotConnected ,
142- libc:: ECONNABORTED => ErrorKind :: ConnectionAborted ,
143- libc:: EADDRNOTAVAIL => ErrorKind :: AddrNotAvailable ,
144- libc:: EADDRINUSE => ErrorKind :: AddrInUse ,
145- libc:: ENOENT => ErrorKind :: NotFound ,
146- libc:: EINTR => ErrorKind :: Interrupted ,
147- libc:: EINVAL => ErrorKind :: InvalidInput ,
148- libc:: ETIMEDOUT => ErrorKind :: TimedOut ,
149- libc:: EEXIST => ErrorKind :: AlreadyExists ,
150- libc:: ENOSYS => ErrorKind :: Unsupported ,
151- libc:: ENOMEM => ErrorKind :: OutOfMemory ,
138+ libc:: EADDRINUSE => AddrInUse ,
139+ libc:: EADDRNOTAVAIL => AddrNotAvailable ,
140+ libc:: ECONNABORTED => ConnectionAborted ,
141+ libc:: ECONNREFUSED => ConnectionRefused ,
142+ libc:: ECONNRESET => ConnectionReset ,
143+ libc:: EEXIST => AlreadyExists ,
144+ libc:: EINTR => Interrupted ,
145+ libc:: EINVAL => InvalidInput ,
146+ libc:: ENOENT => NotFound ,
147+ libc:: ENOMEM => OutOfMemory ,
148+ libc:: ENOSYS => Unsupported ,
149+ libc:: ENOTCONN => NotConnected ,
150+ libc:: EPIPE => BrokenPipe ,
151+ libc:: ETIMEDOUT => TimedOut ,
152+
153+ libc:: EACCES | libc:: EPERM => PermissionDenied ,
152154
153155 // These two constants can have the same value on some systems,
154156 // but different values on others, so we can't use a match
155157 // clause
156- x if x == libc:: EAGAIN || x == libc:: EWOULDBLOCK => ErrorKind :: WouldBlock ,
158+ x if x == libc:: EAGAIN || x == libc:: EWOULDBLOCK => WouldBlock ,
157159
158- _ => ErrorKind :: Uncategorized ,
160+ _ => Uncategorized ,
159161 }
160162}
161163
0 commit comments