File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -4016,6 +4016,10 @@ feature! {
40164016
40174017/// Close all the file descriptor from a given range.
40184018/// An optional flag can be applied to modify its behavior.
4019+ ///
4020+ /// # Safety
4021+ ///
4022+ /// This function as there are risks of double closes on the file descriptors.
40194023 #[ cfg( any(
40204024 all( target_os = "linux" , target_env = "gnu" ) ,
40214025 target_os = "freebsd"
Original file line number Diff line number Diff line change @@ -1410,8 +1410,13 @@ fn test_close_range() {
14101410 for tf in & mut tempfile {
14111411 let _ = tf. write_all ( CONTENTS ) ;
14121412 }
1413- let areclosed =
1414- unsafe { close_range ( tempfile[ 0 ] . as_file ( ) . as_fd ( ) , tempfile[ 2 ] . as_file ( ) . as_fd ( ) , CloseRangeFlags :: CLOSE_RANGE_CLOEXEC ) } ;
1413+ let areclosed = unsafe {
1414+ close_range (
1415+ tempfile[ 0 ] . as_file ( ) . as_fd ( ) ,
1416+ tempfile[ 2 ] . as_file ( ) . as_fd ( ) ,
1417+ CloseRangeFlags :: CLOSE_RANGE_CLOEXEC ,
1418+ )
1419+ } ;
14151420 assert_eq ! (
14161421 areclosed
14171422 . expect( "close_range failed" )
You can’t perform that action at this time.
0 commit comments