File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ use super::native_mux_impl;
5
5
6
6
use std:: fs:: File ;
7
7
use std:: io;
8
- use std:: os:: unix:: io:: OwnedFd ;
9
8
use std:: os:: unix:: io:: { AsRawFd , FromRawFd , IntoRawFd , RawFd } ;
9
+ use std:: os:: unix:: io:: { BorrowedFd , OwnedFd } ;
10
10
use std:: pin:: Pin ;
11
11
use std:: process;
12
12
use std:: task:: { Context , Poll } ;
@@ -145,7 +145,13 @@ macro_rules! impl_from_impl_child_io {
145
145
let fd = arg. as_raw_fd( ) ;
146
146
147
147
// safety: arg.as_raw_fd() is guaranteed to return a valid fd.
148
- let fd = unsafe { dup( fd) } ?. into_raw_fd( ) ;
148
+ let fd = unsafe { BorrowedFd :: borrow_raw( fd) } ;
149
+
150
+ let fd = fd
151
+ . try_clone_to_owned( )
152
+ . map_err( Error :: ChildIo ) ?
153
+ . into_raw_fd( ) ;
154
+
149
155
<$inner>:: from_raw_fd_checked( fd)
150
156
. map( Self )
151
157
. map_err( Error :: ChildIo )
You can’t perform that action at this time.
0 commit comments