Skip to content

Commit bc14f95

Browse files
committed
doc addition
1 parent 6542200 commit bc14f95

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/unistd.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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"

test/test_unistd.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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")

0 commit comments

Comments
 (0)