Skip to content

Commit c9fa667

Browse files
committed
DragonFly 6.0 added fexecve(2)
1 parent 57d4c86 commit c9fa667

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ targets = [
2525
]
2626

2727
[dependencies]
28-
libc = { version = "0.2.102", features = [ "extra_traits" ] }
28+
libc = { version = "0.2.105", features = [ "extra_traits" ] }
2929
bitflags = "1.3.1"
3030
cfg-if = "1.0"
3131

src/unistd.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -815,11 +815,9 @@ pub fn execvpe<SA: AsRef<CStr>, SE: AsRef<CStr>>(filename: &CStr, args: &[SA], e
815815
///
816816
/// This function is similar to `execve`, except that the program to be executed
817817
/// is referenced as a file descriptor instead of a path.
818-
// Note for NetBSD and OpenBSD: although rust-lang/libc includes it (under
819-
// unix/bsd/netbsdlike/) fexecve is not currently implemented on NetBSD nor on
820-
// OpenBSD.
821818
#[cfg(any(target_os = "android",
822819
target_os = "linux",
820+
target_os = "dragonfly",
823821
target_os = "freebsd"))]
824822
#[inline]
825823
pub fn fexecve<SA: AsRef<CStr> ,SE: AsRef<CStr>>(fd: RawFd, args: &[SA], env: &[SE]) -> Result<Infallible> {

test/test_unistd.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,25 +363,21 @@ cfg_if!{
363363
if #[cfg(target_os = "android")] {
364364
execve_test_factory!(test_execve, execve, CString::new("/system/bin/sh").unwrap().as_c_str());
365365
execve_test_factory!(test_fexecve, fexecve, File::open("/system/bin/sh").unwrap().into_raw_fd());
366-
} else if #[cfg(any(target_os = "freebsd",
366+
} else if #[cfg(any(target_os = "dragonfly",
367+
target_os = "freebsd",
367368
target_os = "linux"))] {
368369
// These tests frequently fail on musl, probably due to
369370
// https://github.com/nix-rust/nix/issues/555
370371
execve_test_factory!(test_execve, execve, CString::new("/bin/sh").unwrap().as_c_str());
371372
execve_test_factory!(test_fexecve, fexecve, File::open("/bin/sh").unwrap().into_raw_fd());
372-
} else if #[cfg(any(target_os = "dragonfly",
373-
target_os = "illumos",
373+
} else if #[cfg(any(target_os = "illumos",
374374
target_os = "ios",
375375
target_os = "macos",
376376
target_os = "netbsd",
377377
target_os = "openbsd",
378378
target_os = "solaris"))] {
379379
execve_test_factory!(test_execve, execve, CString::new("/bin/sh").unwrap().as_c_str());
380-
// No fexecve() on DragonFly, ios, macos, NetBSD, OpenBSD.
381-
//
382-
// Note for NetBSD and OpenBSD: although rust-lang/libc includes it
383-
// (under unix/bsd/netbsdlike/) fexecve is not currently implemented on
384-
// NetBSD nor on OpenBSD.
380+
// No fexecve() on ios, macos, NetBSD, OpenBSD.
385381
}
386382
}
387383

0 commit comments

Comments
 (0)