File tree 3 files changed +1
-25
lines changed
3 files changed +1
-25
lines changed Original file line number Diff line number Diff line change @@ -287,22 +287,7 @@ impl File {
287
287
let fd = cvt_r ( || unsafe {
288
288
open ( path. as_ptr ( ) , flags, opts. mode as c_int )
289
289
} ) ?;
290
- let fd = FileDesc :: new ( fd) ;
291
- // Currently the standard library supports Linux 2.6.18 which did not
292
- // have the O_CLOEXEC flag (passed above). If we're running on an older
293
- // Linux kernel then the flag is just ignored by the OS. After we open
294
- // the first file, we check whether it has CLOEXEC set. If it doesn't,
295
- // we will explicitly ask for a CLOEXEC fd for every further file we
296
- // open, if it does, we will skip that step.
297
- //
298
- // The CLOEXEC flag, however, is supported on versions of macOS/BSD/etc
299
- // that we support, so we only do this on Linux currently.
300
- fn ensure_cloexec ( _: & FileDesc ) -> io:: Result < ( ) > {
301
- Ok ( ( ) )
302
- }
303
-
304
- ensure_cloexec ( & fd) ?;
305
- Ok ( File ( fd) )
290
+ Ok ( File ( FileDesc :: new ( fd) ) )
306
291
}
307
292
308
293
pub fn file_attr ( & self ) -> io:: Result < FileAttr > {
Original file line number Diff line number Diff line change @@ -141,10 +141,6 @@ impl Socket {
141
141
142
142
pub fn accept ( & self , storage : * mut sockaddr , len : * mut socklen_t )
143
143
-> io:: Result < Socket > {
144
- // Unfortunately the only known way right now to accept a socket and
145
- // atomically set the CLOEXEC flag is to use the `accept4` syscall on
146
- // Linux. This was added in 2.6.28, however, and because we support
147
- // 2.6.18 we must detect this support dynamically.
148
144
let fd = cvt_r ( || unsafe {
149
145
libc:: accept ( self . 0 . raw ( ) , storage, len)
150
146
} ) ?;
Original file line number Diff line number Diff line change @@ -11,11 +11,6 @@ pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> {
11
11
static INVALID : AtomicBool = AtomicBool :: new ( false ) ;
12
12
13
13
let mut fds = [ 0 ; 2 ] ;
14
-
15
- // Unfortunately the only known way right now to create atomically set the
16
- // CLOEXEC flag is to use the `pipe2` syscall on Linux. This was added in
17
- // 2.6.27, however, and because we support 2.6.18 we must detect this
18
- // support dynamically.
19
14
cvt ( unsafe { libc:: pipe ( fds. as_mut_ptr ( ) ) } ) ?;
20
15
21
16
let fd0 = FileDesc :: new ( fds[ 0 ] ) ;
You can’t perform that action at this time.
0 commit comments