From 2734ce1e27ca43dc5bdf88e264f162986797a998 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 28 Sep 2025 11:01:49 +0100 Subject: [PATCH] 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 --- server/daemon.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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"); -- 2.30.2