Skip to content

Commit c3babcd

Browse files
committed
Disallow permission errors in device test
Since the test is now not run by default it doesn't make sense to allow permission errors. Also reduces explanation in the `panic!` calls since that's already in the ignore attribute.
1 parent 6dc5d63 commit c3babcd

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

tests/socket.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ fn device() {
640640
for interface in INTERFACES.iter() {
641641
if let Err(err) = socket.bind_device(Some(interface.as_bytes())) {
642642
// Network interface is not available try another.
643-
if matches!(err.raw_os_error(), Some(libc::ENODEV) | Some(libc::EPERM)) {
643+
if matches!(err.raw_os_error(), Some(libc::ENODEV)) {
644644
eprintln!("error binding to device (`{}`): {}", interface, err);
645645
continue;
646646
} else {
@@ -658,11 +658,7 @@ fn device() {
658658
return;
659659
}
660660

661-
panic!(
662-
"failing to bind to any device. \
663-
Note that on Linux this requires the `CAP_NET_RAW` permission. \
664-
This can be given using `sudo setcap cap_net_raw=ep $test_bin`."
665-
);
661+
panic!("failed to bind to any device.");
666662
}
667663

668664
fn any_ipv4() -> SockAddr {

0 commit comments

Comments
 (0)