From: Ian Jackson Date: Sun, 28 Sep 2025 10:01:49 +0000 (+0100) Subject: Use .into_raw_fd for null_fd for compatibility with nix 30 X-Git-Tag: debian/1.3.1~9^2~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=2734ce1e27ca43dc5bdf88e264f162986797a998;p=hippotat.git Use .into_raw_fd for null_fd for compatibility with nix 30 In nix <=29, open returns RawFd for which .into_raw_fd is a no-op. Signed-off-by: Ian Jackson --- diff --git a/server/daemon.rs b/server/daemon.rs index 944d8dc..e3018fa 100644 --- a/server/daemon.rs +++ b/server/daemon.rs @@ -6,7 +6,8 @@ use std::convert::TryInto; use std::ffi::CStr; use std::io::IoSlice; use std::os::raw::{c_char, c_int}; -use std::os::unix::io::RawFd; +use std::os::unix::io::RawFd; // TODO io-safety, MSRV>=1.66, maybe nix>=1.30 +use std::os::fd::IntoRawFd; // TODO io-safety maybe remove use std::slice; use std::str; use std::thread::panicking; @@ -151,7 +152,8 @@ impl Daemoniser { pub fn phase1() -> Self { unsafe { let null_fd = open(cstr!(b"/dev/null\0"), OFlag::O_RDWR, Mode::empty()) - .context("open /dev/null"); + .context("open /dev/null") + .into_raw_fd(); mdup2(null_fd, 0, "null onto stdin"); let (st_rfd, st_wfd) = compat::pipe().context("pipe");