about summary refs log tree commit diff
path: root/src/libstd/rt/io/native
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-10-17 21:08:48 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-10-24 14:21:58 -0700
commit620ab3853abf99ecea3a3d055f47cd6d06433c95 (patch)
tree61f35d294ededfa57258fee32e83b54f7f2e0536 /src/libstd/rt/io/native
parent279c35182050889cba42e4adb1438a7f640fdabd (diff)
Test fixes and merge conflicts
Diffstat (limited to 'src/libstd/rt/io/native')
-rw-r--r--src/libstd/rt/io/native/file.rs18
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,