Skip to content

Commit

Permalink
Use UUID in temporary Ozy binary name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tao Lu committed Dec 27, 2023
1 parent fa7c733 commit 677edd9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rozy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use anyhow::{anyhow, Context, Error, Result};
use clap::{Parser, Subcommand};
use semver::Version;
use std::os::unix::fs::PermissionsExt;
use uuid::Uuid;
use which::which;

use crate::files::{check_path, get_ozy_bin_dir};
Expand Down Expand Up @@ -267,7 +268,7 @@ fn update(path_to_ozy: &std::path::PathBuf, url: &Option<String>) -> Result<()>
let download_url = config_update_slice["ozy_download"].as_str().unwrap();
eprintln!("Downloading from {}", download_url);

let dest_path = files::get_ozy_bin_dir()?.join("ozy.tmp");
let dest_path = files::get_ozy_bin_dir()?.join(format!("ozy.tmp.{}", Uuid::new_v4()));
files::delete_if_exists(&dest_path)?;
utils::download_to(&dest_path, download_url)?;
let mut perms = std::fs::metadata(&dest_path)?.permissions();
Expand Down

0 comments on commit 677edd9

Please sign in to comment.