File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change
1
+ Add ` close_range ` in unistd for Linux/glibc and FreeBSD
Original file line number Diff line number Diff line change @@ -1393,7 +1393,10 @@ fn test_group_from() {
1393
1393
}
1394
1394
1395
1395
#[ test]
1396
- #[ cfg( any( all( target_os = "linux" , target_env = "gnu" ) , target_os = "freebsd" ) ) ]
1396
+ #[ cfg( any(
1397
+ all( target_os = "linux" , target_env = "gnu" ) ,
1398
+ target_os = "freebsd"
1399
+ ) ) ]
1397
1400
fn test_close_range ( ) {
1398
1401
use tempfile:: NamedTempFile ;
1399
1402
const CONTENTS : & [ u8 ] = b"abcdef123456" ;
@@ -1403,6 +1406,12 @@ fn test_close_range() {
1403
1406
tempfile3. write_all ( CONTENTS ) . unwrap ( ) ;
1404
1407
tempfile2. write_all ( CONTENTS ) . unwrap ( ) ;
1405
1408
tempfile1. write_all ( CONTENTS ) . unwrap ( ) ;
1406
- let areclosed = close_range ( tempfile1, tempfile3, CloseRangeFlags :: CLOSE_RANGE_CLOEXEC ) ;
1407
- assert_eq ! ( areclosed. expect( "close_range failed" ) . expect( "invalid flag" ) , 0 ) ;
1409
+ let areclosed =
1410
+ close_range ( tempfile1, tempfile3, CloseRangeFlags :: CLOSE_RANGE_CLOEXEC ) ;
1411
+ assert_eq ! (
1412
+ areclosed
1413
+ . expect( "close_range failed" )
1414
+ . expect( "invalid flag" ) ,
1415
+ 0
1416
+ ) ;
1408
1417
}
You can’t perform that action at this time.
0 commit comments