diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-10-17 21:08:48 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-10-24 14:21:58 -0700 |
| commit | 620ab3853abf99ecea3a3d055f47cd6d06433c95 (patch) | |
| tree | 61f35d294ededfa57258fee32e83b54f7f2e0536 /src/libstd/rt/io/native | |
| parent | 279c35182050889cba42e4adb1438a7f640fdabd (diff) | |
Test fixes and merge conflicts
Diffstat (limited to 'src/libstd/rt/io/native')
| -rw-r--r-- | src/libstd/rt/io/native/file.rs | 18 |
1 files changed, 15 insertions, 3 deletions
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, |
