From bf1352a3c0dfaf2651292855050e7ccbda705b18 Mon Sep 17 00:00:00 2001 From: ShengYi Hung Date: Wed, 26 Aug 2026 00:33:17 -0500 Subject: [PATCH] file: Fix FreeBSD build Replacing platform-dependent MetadataExt st_dev with unix specified dev method. As it is st_dev underline, it is safe to make such change. --- src/file.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/file.rs b/src/file.rs index 3029dab..817e437 100644 --- a/src/file.rs +++ b/src/file.rs @@ -2,8 +2,7 @@ use anyhow::{bail, Context, Result}; use log::debug; use std::fs; use std::io::{self, Write}; -use std::os::linux::fs::MetadataExt; -use std::os::unix::fs::{symlink, OpenOptionsExt}; +use std::os::unix::fs::{symlink, MetadataExt, OpenOptionsExt}; use std::path::{Path, PathBuf}; /// Canonicalise `path`, checking for directory traversal outside of `base`. @@ -76,12 +75,12 @@ pub fn link_localtime( // We should seek to avoid avoid /etc/localtime disappearing, even briefly, to avoid // applications being unhappy -- that's why we insist on atomic rename. - let tmp_dev = localtime_tmp_path.metadata()?.st_dev(); + let tmp_dev = localtime_tmp_path.metadata()?.dev(); let target_dev = localtime_path .parent() .context("localtime path has no parent")? .metadata()? - .st_dev(); + .dev(); if tmp_dev != target_dev { fs::remove_file(&localtime_tmp_path)?;