Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/impossible-models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ impl From<io::Error> for Error {
}
}

#[cfg(unix)]
impl From<rustix::io::Errno> for Error {
fn from(value: rustix::io::Errno) -> Self {
Self::Io(value.into())
}
}

impl From<reqwest::Error> for Error {
fn from(value: reqwest::Error) -> Self {
let kind = if value.is_connect() {
Expand Down
7 changes: 4 additions & 3 deletions crates/impossible-server-core/src/security.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fn open_secret_file(path: &Path) -> Result<File, CredentialError> {
let mut options = OpenOptions::new();
options.read(true);
configure_no_follow(&mut options);
options.open(path).map_err(map_open_error)
options.open(path).map_err(|error| map_open_error(&error))
}

#[cfg(unix)]
Expand All @@ -136,9 +136,10 @@ fn configure_no_follow(options: &mut OpenOptions) {
#[cfg(not(any(unix, windows)))]
fn configure_no_follow(_options: &mut OpenOptions) {}

fn map_open_error(_error: std::io::Error) -> CredentialError {
#[cfg_attr(not(unix), allow(unused_variables))]
fn map_open_error(error: &std::io::Error) -> CredentialError {
#[cfg(unix)]
if _error.raw_os_error() == Some(libc::ELOOP) {
if error.raw_os_error() == Some(libc::ELOOP) {
return CredentialError::Invalid;
}
CredentialError::Unavailable
Expand Down
Loading