From: Ian Jackson Date: Sun, 25 Feb 2024 01:46:52 +0000 (+0000) Subject: build.rs: Set --cfg=nix_ge_0_27, not nix_0_27 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=1a494334e78b6a97bdbccd2b3bea459aea69ed92;p=hippotat.git build.rs: Set --cfg=nix_ge_0_27, not nix_0_27 Don't use exact semver matching. Use the test for all later versions, in the hope that the later version will be similar. Signed-off-by: Ian Jackson --- diff --git a/build.rs b/build.rs index d52f747..f3f2d9a 100644 --- a/build.rs +++ b/build.rs @@ -57,8 +57,8 @@ fn main(){ let nix = &nix.version; let nix: semver::Version = nix.parse().expect(nix); - for test in ["0.27"] { - let cfg = test.replace('.', "_"); + for test in [">=0.27"] { + let cfg = test.replace('.', "_").replace(">=", "ge_"); let test: semver::VersionReq = test.parse().unwrap(); if test.matches(&nix) { println!("cargo:rustc-cfg=nix_{cfg}"); diff --git a/src/compat.rs b/src/compat.rs index eef04fe..75d478d 100644 --- a/src/compat.rs +++ b/src/compat.rs @@ -9,7 +9,7 @@ use crate::prelude::*; pub unsafe fn writev(fd: c_int, iov: &[IoSlice]) -> nix::Result { nix::sys::uio::writev( { cfg_if! { - if #[cfg(nix_0_27)] { + if #[cfg(nix_ge_0_27)] { BorrowedFd::borrow_raw(fd) } else { fd