diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6b697aa50382ba5fd10003d7e6c695c7b572cdec..7fb23fe6c17f452a9de360851e9a29a7b5cd07dc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,6 +19,7 @@ build:linux: stage: build script: - rustup toolchain add "$(cat rust-toolchain)" + - rustup component add rust-src - rustup show # Print version info for debugging - make -j "$(nproc)" all diff --git a/src/header/netdb/mod.rs b/src/header/netdb/mod.rs index 8a510171a6153b2cf5b997416ebb4f6cc2f0796a..20816291f33fae1dd004c282a23e18c0d99f601d 100644 --- a/src/header/netdb/mod.rs +++ b/src/header/netdb/mod.rs @@ -893,3 +893,15 @@ pub extern "C" fn gai_strerror(errcode: c_int) -> *const c_char { } .as_ptr() } + +#[no_mangle] +pub extern "C" fn hstrerror(errcode: c_int) -> *const c_char { + match errcode { + HOST_NOT_FOUND => c_str!("Unknown hostname"), + NO_DATA => c_str!("No address for hostname"), + NO_RECOVERY => c_str!("Unknown server error"), + TRY_AGAIN => c_str!("Hostname lookup failure"), + _ => c_str!("Unknown error"), + } + .as_ptr() +}