Skip to content

Commit d81fbf4

Browse files
Fix confusing error message on macOS when running without sudo (#492)
1 parent cbcffe8 commit d81fbf4

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
88

99
### Fixed
1010

11+
* Fix confusing error message on macOS when running without sudo #492 - @chiranjeevi-max
1112
* Fix Ctrl+C handling to use SIGINT signal instead of keypress #491 - @chiranjeevi-max
1213
* Update CONTRIBUTING information #438 - @YJDoc2 @cyqsimon
1314
* Fix new clippy lint #457 - @cyqsimon

src/os/shared.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ pub(crate) fn get_datalink_channel(
7676
ErrorKind::PermissionDenied => Err(GetInterfaceError::PermissionError(
7777
interface.name.to_owned(),
7878
)),
79+
// on macOS/FreeBSD, permission errors when opening BPF devices manifest as
80+
// "No such file or directory" (ENOENT) rather than EPERM
81+
// see https://github.com/imsnif/bandwhich/issues/486
82+
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
83+
ErrorKind::NotFound => Err(GetInterfaceError::PermissionError(
84+
interface.name.to_owned(),
85+
)),
7986
_ => Err(GetInterfaceError::OtherError(format!(
8087
"{}: {e}",
8188
&interface.name

0 commit comments

Comments
 (0)