Skip to content

Commit f68ee84

Browse files
committed
fix nits
1 parent 40ecc41 commit f68ee84

File tree

1 file changed

+4
-4
lines changed
  • library/std/src/sys/unix

1 file changed

+4
-4
lines changed

library/std/src/sys/unix/fs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::ptr;
1010
use crate::sync::Arc;
1111
use crate::sys::fd::FileDesc;
1212
use crate::sys::time::SystemTime;
13-
use crate::sys::{cvt, cvt_r};
13+
use crate::sys::{cvt, cvt_p, cvt_r};
1414
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
1515

1616
#[cfg(any(
@@ -75,7 +75,7 @@ use libc::{
7575
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "l4re"))]
7676
use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64};
7777

78-
#[cfg(not(any(target_os = "redox", target_os = "espidf")))]
78+
#[cfg(not(any(target_os = "redox", target_os = "espidf", miri)))]
7979
mod dir_fd;
8080

8181
// Modern implementation using openat(), unlinkat() and fdopendir()
@@ -1207,8 +1207,8 @@ pub fn readdir(p: &Path) -> io::Result<ReadDir> {
12071207
let root = p.to_path_buf();
12081208
let p = cstr(p)?;
12091209
unsafe {
1210-
let ptr = libc::opendir(p.as_ptr());
1211-
if ptr.is_null() { Err(Error::last_os_error()) } else { Ok(ReadDir::new(Dir(ptr), root)) }
1210+
let ptr = cvt_p(libc::opendir(p.as_ptr()))?;
1211+
Ok(ReadDir::new(Dir(ptr), root))
12121212
}
12131213
}
12141214

0 commit comments

Comments
 (0)