Skip to content

Commit 161ec0a

Browse files
committed
---
yaml --- r: 117759 b: refs/heads/auto c: 03ec8e5 h: refs/heads/master i: 117757: b39d5e2 117755: 231c9b2 117751: 28043e4 117743: f35c669 117727: cd09176 117695: 4910ac1 117631: 6a4562d 117503: 3e73c98 117247: c0a4e01 116735: 6755edc v: v3
1 parent 4e1a137 commit 161ec0a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 298412a6e87be2213bbfc5e6fada9795c405ea13
16+
refs/heads/auto: 03ec8e5cc91b3b6b6ab98ef70aa63a0965c5f6c1
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libstd/io/fs.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ fs::unlink(&path);
5252
use c_str::ToCStr;
5353
use clone::Clone;
5454
use collections::Collection;
55+
use io::standard_error;
5556
use io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode};
5657
use io::{IoResult, IoError, FileStat, SeekStyle, Seek, Writer, Reader};
5758
use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append};
58-
use io;
59+
use io::UpdateIoError;
5960
use io;
6061
use iter::Iterator;
6162
use kinds::Send;
63+
use libc;
6264
use option::{Some, None, Option};
6365
use owned::Box;
6466
use path::{Path, GenericPath};
@@ -67,6 +69,7 @@ use result::{Err, Ok};
6769
use rt::rtio::LocalIo;
6870
use rt::rtio;
6971
use slice::ImmutableVector;
72+
use string::String;
7073
use vec::Vec;
7174

7275
/// Unconstrained file access type that exposes read and write operations
@@ -128,18 +131,18 @@ impl File {
128131
pub fn open_mode(path: &Path,
129132
mode: FileMode,
130133
access: FileAccess) -> IoResult<File> {
131-
let mode = match mode {
134+
let rtio_mode = match mode {
132135
Open => rtio::Open,
133136
Append => rtio::Append,
134137
Truncate => rtio::Truncate,
135138
};
136-
let access = match access {
139+
let rtio_access = match access {
137140
Read => rtio::Read,
138141
Write => rtio::Write,
139142
ReadWrite => rtio::ReadWrite,
140143
};
141144
let err = LocalIo::maybe_raise(|io| {
142-
io.fs_open(&path.to_c_str(), mode, access).map(|fd| {
145+
io.fs_open(&path.to_c_str(), rtio_mode, rtio_access).map(|fd| {
143146
File {
144147
path: path.clone(),
145148
fd: fd,
@@ -775,7 +778,8 @@ impl Reader for File {
775778
e, file.path.display()))
776779
}
777780

778-
let result: IoResult<int> = update_err(self.fd.read(buf), self);
781+
let result = update_err(self.fd.read(buf)
782+
.map_err(IoError::from_rtio_error), self);
779783

780784
match result {
781785
Ok(read) => {
@@ -785,14 +789,14 @@ impl Reader for File {
785789
_ => Ok(read as uint)
786790
}
787791
},
788-
Err(e) => Err(IoError::from_rtio_error(e)),
792+
Err(e) => Err(e)
789793
}
790794
}
791795
}
792796

793797
impl Writer for File {
794798
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
795-
let err = self.fd.write(buf).map_err(IoError::from_rtio_error)
799+
let err = self.fd.write(buf).map_err(IoError::from_rtio_error);
796800
err.update_err("couldn't write to file",
797801
|e| format!("{}; path={}", e, self.path.display()))
798802
}

0 commit comments

Comments
 (0)