Skip to content

Commit 30af57e

Browse files
committed
fix: adjust local_socket_file_mode for OpenBSD
We no longer do the umask fallback, so this test is expected to fail with an unsupported error there.
1 parent 73f0cd6 commit 30af57e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/os/unix/local_socket_mode.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use {
88
libc::mode_t,
99
std::{
1010
ffi::{CString, OsStr},
11+
io,
1112
mem::zeroed,
1213
os::unix::prelude::*,
1314
sync::Arc,
@@ -37,9 +38,22 @@ fn test_inner(path: bool) -> TestResult {
3738
const MODE: libc::mode_t = 0o600;
3839
let (name, listener) =
3940
listen_and_pick_name(&mut namegen_local_socket(make_id!(), path), |nm| {
40-
ListenerOptions::new().name(nm.borrow()).mode(MODE).create_sync()
41+
let rslt =
42+
ListenerOptions::new().name(nm.borrow()).mode(MODE).create_sync().map(Some);
43+
if cfg!(target_os = "openbsd") {
44+
return if rslt.is_ok() {
45+
Err(io::Error::other("unexpected success, please update this test"))
46+
} else {
47+
Ok(None)
48+
};
49+
}
50+
rslt
4151
})?;
52+
53+
// If listener is None, we're on a platform on which we expect this to not be supported
54+
let Some(listener) = listener else { return Ok(()) };
4255
let name = Arc::try_unwrap(name).unwrap();
56+
4357
let _ = Stream::connect(name.borrow()).opname("client connect")?;
4458
let actual_mode = if let Name(NameInner::UdSocketPath(path)) = name {
4559
get_file_mode(&path)

0 commit comments

Comments
 (0)