tools::get_hardware_address - fix FILENAME, use file_get_contents()

This commit is contained in:
Dietmar Maurer 2019-01-25 12:23:47 +01:00
parent af2fddea4f
commit 1631c54fca

View File

@ -387,12 +387,9 @@ pub fn scandir<P, F>(
pub fn get_hardware_address() -> Result<String, Error> {
static FILENAME: &str = "/etc/ssh/assh_host_rsa_key.pub";
let mut file = File::open(FILENAME)?;
let mut contents = Vec::new();
file.read_to_end(&mut contents)?;
static FILENAME: &str = "/etc/ssh/ssh_host_rsa_key.pub";
let contents = file_get_contents(FILENAME)?;
let digest = md5::compute(contents);
Ok(format!("{:0x}", digest))