From 620ab3853abf99ecea3a3d055f47cd6d06433c95 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 17 Oct 2013 21:08:48 -0700 Subject: Test fixes and merge conflicts --- src/libstd/rt/io/native/file.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/libstd/rt/io/native') diff --git a/src/libstd/rt/io/native/file.rs b/src/libstd/rt/io/native/file.rs index a2b2289679a..ba819df071a 100644 --- a/src/libstd/rt/io/native/file.rs +++ b/src/libstd/rt/io/native/file.rs @@ -17,9 +17,18 @@ use os; use prelude::*; use super::super::*; -fn raise_error() { +#[cfg(windows)] +fn get_err(errno: i32) -> (IoErrorKind, &'static str) { + match errno { + libc::EOF => (EndOfFile, "end of file"), + _ => (OtherIoError, "unknown error"), + } +} + +#[cfg(not(windows))] +fn get_err(errno: i32) -> (IoErrorKind, &'static str) { // XXX: this should probably be a bit more descriptive... - let (kind, desc) = match os::errno() as i32 { + match errno { libc::EOF => (EndOfFile, "end of file"), // These two constants can have the same value on some systems, but @@ -28,8 +37,11 @@ fn raise_error() { (ResourceUnavailable, "resource temporarily unavailable"), _ => (OtherIoError, "unknown error"), - }; + } +} +fn raise_error() { + let (kind, desc) = get_err(os::errno() as i32); io_error::cond.raise(IoError { kind: kind, desc: desc, -- cgit 1.4.1-3-g733a5