Skip to content

Commit 1f89ccd

Browse files
committed
Use the upstream version of libc
1 parent 94a4d2b commit 1f89ccd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/fcntl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use {Result, NixPath};
22
use errno::Errno;
3-
use libc::{self, c_int, c_uint, c_char, size_t, ssize_t};
3+
#[cfg(not(target_os = "redox"))]
4+
use libc::c_uint;
5+
use libc::{self, c_int, c_char, size_t, ssize_t};
46
use sys::stat::Mode;
57
#[cfg(not(target_os = "redox"))]
68
use std::os::raw;
@@ -160,8 +162,7 @@ libc_bitflags!(
160162

161163
pub fn open<P: ?Sized + NixPath>(path: &P, oflag: OFlag, mode: Mode) -> Result<RawFd> {
162164
let fd = path.with_nix_path(|cstr| {
163-
let modebits = c_uint::from(mode.bits());
164-
unsafe { libc::open(cstr.as_ptr(), oflag.bits(), modebits) }
165+
unsafe { libc::open(cstr.as_ptr(), oflag.bits(), mode.bits()) }
165166
})?;
166167

167168
Errno::result(fd)
@@ -170,8 +171,7 @@ pub fn open<P: ?Sized + NixPath>(path: &P, oflag: OFlag, mode: Mode) -> Result<R
170171
#[cfg(not(target_os = "redox"))]
171172
pub fn openat<P: ?Sized + NixPath>(dirfd: RawFd, path: &P, oflag: OFlag, mode: Mode) -> Result<RawFd> {
172173
let fd = path.with_nix_path(|cstr| {
173-
let modebits = c_uint::from(mode.bits());
174-
unsafe { libc::openat(dirfd, cstr.as_ptr(), oflag.bits(), modebits) }
174+
unsafe { libc::openat(dirfd, cstr.as_ptr(), oflag.bits(), mode.bits()) }
175175
})?;
176176
Errno::result(fd)
177177
}

0 commit comments

Comments
 (0)