diff --git a/Cargo.lock b/Cargo.lock index f925fcf..ec5415f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -503,7 +503,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436" dependencies = [ - "nix 0.27.1", + "nix", "rand", ] @@ -2082,17 +2082,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if 1.0.0", - "libc", -] - [[package]] name = "nix" version = "0.27.1" @@ -3067,7 +3056,7 @@ dependencies = [ "itertools", "lazy_static", "migration", - "nix 0.26.4", + "nix", "num_cpus", "once_cell", "proctitle", diff --git a/Cargo.toml b/Cargo.toml index 043c477..8f57e2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ envy = "0.4.2" heck = { version = "0.4.1", features = ["unicode"] } itertools = "0.12.1" lazy_static = "1.4.0" -nix = { version = "0.26.4", default-features = false, features = ["dir", "process", "user"] } +nix = { version = "0.27.1", default-features = false, features = ["dir", "process", "user"] } num_cpus = "1.16.0" once_cell = { version = "1.19.0", features = ["parking_lot"] } proctitle = "0.1.1" diff --git a/src/daemon.rs b/src/daemon.rs index 4229cd2..f074ed0 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -90,7 +90,7 @@ pub(crate) fn open_pid_file(env: &EnvVars) -> Result { .map_err(|e| Error::new(e).context("PID file is locked (process already running?)"))?; // Erase and write new PID - ftruncate(pid_file.as_raw_fd(), 0)?; + ftruncate(&pid_file, 0)?; pid_file .write_all(getpid().to_string().as_bytes()) .map_err(|e| Error::new(e).context("Failed to write to PID file"))?; diff --git a/src/main.rs b/src/main.rs index fbfbd33..1067885 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ * work. If not, see . */ -use std::{fs::File, net::SocketAddr, os::fd::AsRawFd}; +use std::{fs::File, net::SocketAddr}; use anyhow::Result; use axum::Server; @@ -100,7 +100,7 @@ async fn shutdown_signal(pid_file: &mut File) { error!("signal received, starting graceful shutdown"); // Clear PID file - let _ = ftruncate(pid_file.as_raw_fd(), 0); + let _ = ftruncate(pid_file, 0); } // We must fork before we do anything else. @@ -142,7 +142,7 @@ async fn tokio_main(env: &EnvVars, pid_file: &mut File) -> Result<()> { server.await?; // FIXME - do we actually get here? - let _ = ftruncate(pid_file.as_raw_fd(), 0); + let _ = ftruncate(pid_file, 0); Ok(()) }