Skip to content

Commit 8424637

Browse files
committed
Remove CLOEXEC workarounds for Linux 2.6.18.
Rust itself has updated its minimum supported versison to 2.6.32 [here](rust-lang/rust#74606). Fixes #85.
1 parent 37c9e80 commit 8424637

File tree

4 files changed

+1
-73
lines changed

4 files changed

+1
-73
lines changed

cap-primitives/src/rsix/fs/open_unchecked.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rsix::io;
77
use std::fs;
88
use std::path::Path;
99
#[cfg(any(target_os = "android", target_os = "linux"))]
10-
use {crate::fs::ensure_cloexec, io_lifetimes::AsFd};
10+
use io_lifetimes::AsFd;
1111

1212
/// *Unsandboxed* function similar to `open`, but which does not perform
1313
/// sandboxing.
@@ -23,9 +23,6 @@ pub(crate) fn open_unchecked(
2323

2424
let err = match openat(start, path, oflags, mode) {
2525
Ok(file) => {
26-
#[cfg(any(target_os = "android", target_os = "linux"))]
27-
ensure_cloexec(file.as_fd()).map_err(OpenUncheckedError::Other)?;
28-
2926
return Ok(fs::File::from_fd(file.into()));
3027
}
3128
Err(err) => err,

cap-primitives/src/rsix/linux/fs/ensure_cloexec.rs

Lines changed: 0 additions & 64 deletions
This file was deleted.

cap-primitives/src/rsix/linux/fs/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
mod canonicalize_impl;
2-
mod ensure_cloexec;
32
mod file_metadata;
43
mod file_path;
54
mod open_entry_impl;
@@ -11,7 +10,6 @@ mod stat_impl;
1110

1211
pub(crate) use crate::fs::via_parent::set_times_nofollow as set_times_nofollow_impl;
1312
pub(crate) use canonicalize_impl::canonicalize_impl;
14-
pub(crate) use ensure_cloexec::ensure_cloexec;
1513
pub(crate) use file_path::file_path;
1614
pub(crate) use open_entry_impl::open_entry_impl;
1715
pub(crate) use open_impl::{open_beneath, open_impl};

cap-primitives/src/rsix/linux/fs/open_impl.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ pub(crate) fn open_beneath(
7474
) {
7575
Ok(file) => {
7676
let file = fs::File::from_into_fd(file);
77-
// Note that we don't bother with `ensure_cloexec` here
78-
// because Linux has supported `O_CLOEXEC` since 2.6.18,
79-
// and `openat2` was introduced in 5.6.
8077

8178
#[cfg(racy_asserts)]
8279
check_open(start, path, options, &file);

0 commit comments

Comments
 (0)