Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

engine: read the child's errno portably so the lib-test target builds off Linux (#2679)

snmsoodan0be734ec9653
diff --git a/engine/crates/xerj-engine/src/node_lock.rs b/engine/crates/xerj-engine/src/node_lock.rs
index a4b77e66f..39db280c1 100644
--- a/engine/crates/xerj-engine/src/node_lock.rs
+++ b/engine/crates/xerj-engine/src/node_lock.rs
@@ -817,7 +817,13 @@ mod tests {
#[cfg(all(unix, not(miri)))]
fn child_errno() -> libc::c_int {
- unsafe { *libc::__errno_location() }
+ // #2473 follow-up: `__errno_location` is glibc-only. Naming it made the
+ // whole lib-test target fail to compile on macOS and the BSDs
+ // (`cannot find function __errno_location in crate libc`), which is
+ // every test in this crate, not just the fork ones. `last_os_error`
+ // reads the same thread-local errno through the standard library's
+ // per-platform accessor and allocates nothing.
+ std::io::Error::last_os_error().raw_os_error().unwrap_or(0)
}
#[cfg(all(unix, not(miri)))]