about summary refs log tree commit diff
path: root/src/libstd/io
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-11-01 12:50:13 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-11-08 20:41:17 -0800
commit1ccb50eaa670f86b69e7a64484a8c97e13169183 (patch)
tree77042c08dac06aa8c631a712f34231c782761117 /src/libstd/io
parent6bc8f164b09b9994e6a2d4c4ca60d7d36c09d3fe (diff)
std: Change how EBADF is handled in `sys`
This commit removes the reexport of `EBADF_ERR` as a constant from
libstd's portability facade, instead opting for a platform-specific
function that specifically queries an `io::Error`. Not all platforms may
have a constant for this, so it makes the intent a little more clear
that a code need not be supplied, just an answer to a query.
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/stdio.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs
index fb489bf487b..831688bb73d 100644
--- a/src/libstd/io/stdio.rs
+++ b/src/libstd/io/stdio.rs
@@ -121,10 +121,8 @@ impl<R: io::Read> io::Read for Maybe<R> {
 }
 
 fn handle_ebadf<T>(r: io::Result<T>, default: T) -> io::Result<T> {
-    use sys::stdio::EBADF_ERR;
-
     match r {
-        Err(ref e) if e.raw_os_error() == Some(EBADF_ERR) => Ok(default),
+        Err(ref e) if stdio::is_ebadf(e) => Ok(default),
         r => r
     }
 }