From 92069b224d2267c6c664c9ac6dff929f9640f241 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 1 Jun 2022 15:05:43 +0200 Subject: [PATCH] update proxmox-schema to nix 0.24.1 Signed-off-by: Wolfgang Bumiller --- proxmox-schema/Cargo.toml | 2 +- proxmox-schema/src/upid.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/proxmox-schema/Cargo.toml b/proxmox-schema/Cargo.toml index 1b75db7a..4196de05 100644 --- a/proxmox-schema/Cargo.toml +++ b/proxmox-schema/Cargo.toml @@ -18,7 +18,7 @@ textwrap = "0.11" # the upid type needs this for 'getpid' libc = { version = "0.2", optional = true } -nix = { version = "0.19", optional = true } +nix = { version = "0.24.1", optional = true } proxmox-api-macro = { path = "../proxmox-api-macro", optional = true, version = "1.0.3" } diff --git a/proxmox-schema/src/upid.rs b/proxmox-schema/src/upid.rs index 6b20f9d8..6c567209 100644 --- a/proxmox-schema/src/upid.rs +++ b/proxmox-schema/src/upid.rs @@ -209,6 +209,7 @@ fn unescape_id(text: &str) -> Result { #[cfg(feature = "upid-api-impl")] mod upid_impl { + use std::os::unix::ffi::OsStrExt; use std::sync::atomic::{AtomicUsize, Ordering}; use anyhow::{bail, format_err, Error}; @@ -246,8 +247,8 @@ mod upid_impl { worker_type: worker_type.to_owned(), worker_id, auth_id, - node: nix::sys::utsname::uname() - .nodename() + node: std::str::from_utf8(nix::sys::utsname::uname()?.nodename().as_bytes()) + .map_err(|_| format_err!("non-utf8 nodename not supported"))? .split('.') .next() .ok_or_else(|| format_err!("failed to get nodename from uname()"))?