From 274f7d05f443bf6866a3386922006f7fcdec965f Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 19 Jan 2024 10:51:17 +0100 Subject: [PATCH] cleanup more unnecesary allocations Signed-off-by: Wolfgang Bumiller --- src/config/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 00e42dac..324fabca 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -8,7 +8,7 @@ use nix::sys::stat::Mode; use openssl::pkey::PKey; use openssl::rsa::Rsa; use openssl::x509::X509Builder; -use std::path::PathBuf; +use std::path::Path; use proxmox_lang::try_block; @@ -84,8 +84,8 @@ pub fn create_configdir() -> Result<(), Error> { /// Update self signed node certificate. pub fn update_self_signed_cert(force: bool) -> Result<(), Error> { - let key_path = PathBuf::from(configdir!("/proxy.key")); - let cert_path = PathBuf::from(configdir!("/proxy.pem")); + let key_path = Path::new(configdir!("/proxy.key")); + let cert_path = Path::new(configdir!("/proxy.pem")); if key_path.exists() && cert_path.exists() && !force { return Ok(()); @@ -183,8 +183,8 @@ pub fn update_self_signed_cert(force: bool) -> Result<(), Error> { } pub(crate) fn set_proxy_certificate(cert_pem: &[u8], key_pem: &[u8]) -> Result<(), Error> { - let key_path = PathBuf::from(configdir!("/proxy.key")); - let cert_path = PathBuf::from(configdir!("/proxy.pem")); + let key_path = Path::new(configdir!("/proxy.key")); + let cert_path = Path::new(configdir!("/proxy.pem")); create_configdir()?; pbs_config::replace_backup_config(key_path, key_pem)