1
1
use { Result , NixPath } ;
2
2
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} ;
4
6
use sys:: stat:: Mode ;
5
7
#[ cfg( not( target_os = "redox" ) ) ]
6
8
use std:: os:: raw;
@@ -160,8 +162,7 @@ libc_bitflags!(
160
162
161
163
pub fn open < P : ?Sized + NixPath > ( path : & P , oflag : OFlag , mode : Mode ) -> Result < RawFd > {
162
164
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 ( ) ) }
165
166
} ) ?;
166
167
167
168
Errno :: result ( fd)
@@ -170,8 +171,7 @@ pub fn open<P: ?Sized + NixPath>(path: &P, oflag: OFlag, mode: Mode) -> Result<R
170
171
#[ cfg( not( target_os = "redox" ) ) ]
171
172
pub fn openat < P : ?Sized + NixPath > ( dirfd : RawFd , path : & P , oflag : OFlag , mode : Mode ) -> Result < RawFd > {
172
173
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 ( ) ) }
175
175
} ) ?;
176
176
Errno :: result ( fd)
177
177
}
0 commit comments