replace file_set_contents with replace_file

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2019-12-18 11:05:30 +01:00
parent a66e7920dc
commit feaa1ad35f
9 changed files with 51 additions and 39 deletions

View File

@ -15,7 +15,7 @@ use percent_encoding::percent_encode;
use xdg::BaseDirectories;
use proxmox::tools::{
fs::{file_get_json, file_set_contents},
fs::{file_get_json, replace_file, CreateOptions},
};
use super::pipe_to_stream::PipeToSendStream;
@ -52,7 +52,7 @@ pub fn delete_ticket_info(server: &str, username: &str) -> Result<(), Error> {
map.remove(username);
}
file_set_contents(path, data.to_string().as_bytes(), Some(mode))?;
replace_file(path, data.to_string().as_bytes(), CreateOptions::new().perm(mode))?;
Ok(())
}
@ -88,7 +88,7 @@ fn store_ticket_info(server: &str, username: &str, ticket: &str, token: &str) ->
}
}
file_set_contents(path, new_data.to_string().as_bytes(), Some(mode))?;
replace_file(path, new_data.to_string().as_bytes(), CreateOptions::new().perm(mode))?;
Ok(())
}