Skip to content

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

src/libnative/io/file_unix.rs

+12-24
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl rtio::RtioFileStream for FileDesc {
154154

155155
fn fstat(&mut self) -> IoResult<rtio::FileStat> {
156156
let mut stat: libc::stat = unsafe { mem::zeroed() };
157-
match retry(|| unsafe { libc::fstat(self.fd(), &mut stat) }) {
157+
match unsafe { libc::fstat(self.fd(), &mut stat) } {
158158
0 => Ok(mkstat(&stat)),
159159
_ => Err(super::last_error()),
160160
}
@@ -346,9 +346,7 @@ pub fn open(path: &CString, fm: rtio::FileMode, fa: rtio::FileAccess)
346346
}
347347

348348
pub fn mkdir(p: &CString, mode: uint) -> IoResult<()> {
349-
super::mkerr_libc(retry(|| unsafe {
350-
libc::mkdir(p.as_ptr(), mode as libc::mode_t)
351-
}))
349+
super::mkerr_libc(unsafe { libc::mkdir(p.as_ptr(), mode as libc::mode_t) })
352350
}
353351

354352
pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
@@ -393,13 +391,11 @@ pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
393391
}
394392

395393
pub fn unlink(p: &CString) -> IoResult<()> {
396-
super::mkerr_libc(retry(|| unsafe { libc::unlink(p.as_ptr()) }))
394+
super::mkerr_libc(unsafe { libc::unlink(p.as_ptr()) })
397395
}
398396

399397
pub fn rename(old: &CString, new: &CString) -> IoResult<()> {
400-
super::mkerr_libc(retry(|| unsafe {
401-
libc::rename(old.as_ptr(), new.as_ptr())
402-
}))
398+
super::mkerr_libc(unsafe { libc::rename(old.as_ptr(), new.as_ptr()) })
403399
}
404400

405401
pub fn chmod(p: &CString, mode: uint) -> IoResult<()> {
@@ -409,9 +405,7 @@ pub fn chmod(p: &CString, mode: uint) -> IoResult<()> {
409405
}
410406

411407
pub fn rmdir(p: &CString) -> IoResult<()> {
412-
super::mkerr_libc(retry(|| unsafe {
413-
libc::rmdir(p.as_ptr())
414-
}))
408+
super::mkerr_libc(unsafe { libc::rmdir(p.as_ptr()) })
415409
}
416410

417411
pub fn chown(p: &CString, uid: int, gid: int) -> IoResult<()> {
@@ -428,10 +422,10 @@ pub fn readlink(p: &CString) -> IoResult<CString> {
428422
len = 1024; // FIXME: read PATH_MAX from C ffi?
429423
}
430424
let mut buf: Vec<u8> = Vec::with_capacity(len as uint);
431-
match retry(|| unsafe {
425+
match unsafe {
432426
libc::readlink(p, buf.as_ptr() as *mut libc::c_char,
433427
len as libc::size_t) as libc::c_int
434-
}) {
428+
} {
435429
-1 => Err(super::last_error()),
436430
n => {
437431
assert!(n > 0);
@@ -442,15 +436,11 @@ pub fn readlink(p: &CString) -> IoResult<CString> {
442436
}
443437

444438
pub fn symlink(src: &CString, dst: &CString) -> IoResult<()> {
445-
super::mkerr_libc(retry(|| unsafe {
446-
libc::symlink(src.as_ptr(), dst.as_ptr())
447-
}))
439+
super::mkerr_libc(unsafe { libc::symlink(src.as_ptr(), dst.as_ptr()) })
448440
}
449441

450442
pub fn link(src: &CString, dst: &CString) -> IoResult<()> {
451-
super::mkerr_libc(retry(|| unsafe {
452-
libc::link(src.as_ptr(), dst.as_ptr())
453-
}))
443+
super::mkerr_libc(unsafe { libc::link(src.as_ptr(), dst.as_ptr()) })
454444
}
455445

456446
fn mkstat(stat: &libc::stat) -> rtio::FileStat {
@@ -489,15 +479,15 @@ fn mkstat(stat: &libc::stat) -> rtio::FileStat {
489479

490480
pub fn stat(p: &CString) -> IoResult<rtio::FileStat> {
491481
let mut stat: libc::stat = unsafe { mem::zeroed() };
492-
match retry(|| unsafe { libc::stat(p.as_ptr(), &mut stat) }) {
482+
match unsafe { libc::stat(p.as_ptr(), &mut stat) } {
493483
0 => Ok(mkstat(&stat)),
494484
_ => Err(super::last_error()),
495485
}
496486
}
497487

498488
pub fn lstat(p: &CString) -> IoResult<rtio::FileStat> {
499489
let mut stat: libc::stat = unsafe { mem::zeroed() };
500-
match retry(|| unsafe { libc::lstat(p.as_ptr(), &mut stat) }) {
490+
match unsafe { libc::lstat(p.as_ptr(), &mut stat) } {
501491
0 => Ok(mkstat(&stat)),
502492
_ => Err(super::last_error()),
503493
}
@@ -508,9 +498,7 @@ pub fn utime(p: &CString, atime: u64, mtime: u64) -> IoResult<()> {
508498
actime: (atime / 1000) as libc::time_t,
509499
modtime: (mtime / 1000) as libc::time_t,
510500
};
511-
super::mkerr_libc(retry(|| unsafe {
512-
libc::utime(p.as_ptr(), &buf)
513-
}))
501+
super::mkerr_libc(unsafe { libc::utime(p.as_ptr(), &buf) })
514502
}
515503

516504
#[cfg(test)]

0 commit comments

Comments
 (0)