Skip to content

Commit 680ff30

Browse files
committed
Add fexecve cfg attribute for OpenBSD
fexecve doesn't exist on OpenBSD so add conditional compilation for it in unistd and in related tests. The only "reference" that I could find is a mention that fexecve is not implemented on OpenBSD in the manual pages for signal(3) and sigaction(2): Official repository (search for "fexecve"): https://cvsweb.openbsd.org/src/lib/libc/sys/sigaction.2?rev=1.75&content-type=text/x-cvsweb-markup Github mirror: https://github.com/openbsd/src/blob/master/lib/libc/sys/sigaction.2#L619
1 parent 85ae87c commit 680ff30

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/unistd.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,7 @@ pub fn execvpe(filename: &CString, args: &[CString], env: &[CString]) -> Result<
763763
#[cfg(any(target_os = "android",
764764
target_os = "freebsd",
765765
target_os = "linux",
766-
target_os = "netbsd",
767-
target_os = "openbsd"))]
766+
target_os = "netbsd"))]
768767
#[inline]
769768
pub fn fexecve(fd: RawFd, args: &[CString], env: &[CString]) -> Result<Void> {
770769
let args_p = to_exec_array(args);

test/test_unistd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,16 @@ cfg_if!{
230230
execve_test_factory!(test_execve, execve, &CString::new("/system/bin/sh").unwrap());
231231
execve_test_factory!(test_fexecve, fexecve, File::open("/system/bin/sh").unwrap().into_raw_fd());
232232
} else if #[cfg(any(target_os = "freebsd",
233-
target_os = "linux",
234-
target_os = "openbsd"))] {
233+
target_os = "linux"))] {
235234
execve_test_factory!(test_execve, execve, &CString::new("/bin/sh").unwrap());
236235
execve_test_factory!(test_fexecve, fexecve, File::open("/bin/sh").unwrap().into_raw_fd());
237236
} else if #[cfg(any(target_os = "dragonfly",
238237
target_os = "ios",
239238
target_os = "macos",
240-
target_os = "netbsd"))] {
239+
target_os = "netbsd",
240+
target_os = "openbsd"))] {
241241
execve_test_factory!(test_execve, execve, &CString::new("/bin/sh").unwrap());
242-
// No fexecve() on DragonFly, ios, macos, and NetBSD.
242+
// No fexecve() on DragonFly, ios, macos, NetBSD, OpenBSD.
243243
}
244244
}
245245

0 commit comments

Comments
 (0)