]> git.proxmox.com Git - proxmox-backup.git/commitdiff
cleanup more unnecesary allocations
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 19 Jan 2024 09:51:17 +0000 (10:51 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 19 Jan 2024 09:51:17 +0000 (10:51 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/config/mod.rs

index 00e42dac271b7260ca70adff7ed9a5b8b36b1903..324fabca20d5a33e58173751493385069e8523f8 100644 (file)
@@ -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)