From dc3b01147afba9cf6f02c75a96c3d625f9ea2236 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 22 Oct 2024 23:23:18 +0100 Subject: [PATCH] add changelog entry --- changelog/2525.added.md | 1 + test/test_unistd.rs | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 changelog/2525.added.md diff --git a/changelog/2525.added.md b/changelog/2525.added.md new file mode 100644 index 0000000000..89cd93f2e8 --- /dev/null +++ b/changelog/2525.added.md @@ -0,0 +1 @@ +Add `close_range` in unistd for Linux/glibc and FreeBSD diff --git a/test/test_unistd.rs b/test/test_unistd.rs index cab4a585e8..6ed4af5dea 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -1393,7 +1393,10 @@ fn test_group_from() { } #[test] -#[cfg(any(all(target_os = "linux", target_env = "gnu"), target_os = "freebsd"))] +#[cfg(any( + all(target_os = "linux", target_env = "gnu"), + target_os = "freebsd" +))] fn test_close_range() { use tempfile::NamedTempFile; const CONTENTS: &[u8] = b"abcdef123456"; @@ -1403,6 +1406,12 @@ fn test_close_range() { tempfile3.write_all(CONTENTS).unwrap(); tempfile2.write_all(CONTENTS).unwrap(); tempfile1.write_all(CONTENTS).unwrap(); - let areclosed = close_range(tempfile1, tempfile3, CloseRangeFlags::CLOSE_RANGE_CLOEXEC); - assert_eq!(areclosed.expect("close_range failed").expect("invalid flag"), 0); + let areclosed = + close_range(tempfile1, tempfile3, CloseRangeFlags::CLOSE_RANGE_CLOEXEC); + assert_eq!( + areclosed + .expect("close_range failed") + .expect("invalid flag"), + 0 + ); }