Skip to content

Commit

Permalink
dont overwrite file if its already in /data/local/tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
erfur committed Mar 3, 2024
1 parent 3c7e74b commit 24859cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ pub fn verify_elf_file(file_path: &str) -> Result<(), InjectionError> {
}

pub fn copy_file_to_tmp(file_path: &str) -> Result<String, InjectionError> {
// skip if the file is already in /dev/local/tmp
if file_path.starts_with(TMP_DIR_PATH) {
info!("File is already in {}", TMP_DIR_PATH);
return Ok(file_path.to_string());
}

let file_name = match std::path::Path::new(file_path).file_name() {
Some(name) => name.to_str().unwrap(),
None => {
Expand Down

0 comments on commit 24859cd

Please sign in to comment.