Skip to content

Commit

Permalink
Remove CLOEXEC workarounds for Linux 2.6.18.
Browse files Browse the repository at this point in the history
Rust itself has updated its minimum supported versison to
2.6.32 [here](rust-lang/rust#74606).

Fixes #85.
  • Loading branch information
sunfishcode committed Aug 20, 2021
1 parent 37c9e80 commit 6e53944
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 74 deletions.
5 changes: 0 additions & 5 deletions cap-primitives/src/rsix/fs/open_unchecked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use rsix::fs::{cwd, openat, Mode};
use rsix::io;
use std::fs;
use std::path::Path;
#[cfg(any(target_os = "android", target_os = "linux"))]
use {crate::fs::ensure_cloexec, io_lifetimes::AsFd};

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

let err = match openat(start, path, oflags, mode) {
Ok(file) => {
#[cfg(any(target_os = "android", target_os = "linux"))]
ensure_cloexec(file.as_fd()).map_err(OpenUncheckedError::Other)?;

return Ok(fs::File::from_fd(file.into()));
}
Err(err) => err,
Expand Down
64 changes: 0 additions & 64 deletions cap-primitives/src/rsix/linux/fs/ensure_cloexec.rs

This file was deleted.

2 changes: 0 additions & 2 deletions cap-primitives/src/rsix/linux/fs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod canonicalize_impl;
mod ensure_cloexec;
mod file_metadata;
mod file_path;
mod open_entry_impl;
Expand All @@ -11,7 +10,6 @@ mod stat_impl;

pub(crate) use crate::fs::via_parent::set_times_nofollow as set_times_nofollow_impl;
pub(crate) use canonicalize_impl::canonicalize_impl;
pub(crate) use ensure_cloexec::ensure_cloexec;
pub(crate) use file_path::file_path;
pub(crate) use open_entry_impl::open_entry_impl;
pub(crate) use open_impl::{open_beneath, open_impl};
Expand Down
3 changes: 0 additions & 3 deletions cap-primitives/src/rsix/linux/fs/open_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ pub(crate) fn open_beneath(
) {
Ok(file) => {
let file = fs::File::from_into_fd(file);
// Note that we don't bother with `ensure_cloexec` here
// because Linux has supported `O_CLOEXEC` since 2.6.18,
// and `openat2` was introduced in 5.6.

#[cfg(racy_asserts)]
check_open(start, path, options, &file);
Expand Down

0 comments on commit 6e53944

Please sign in to comment.