open_file_locked: improve error message

This commit is contained in:
Dietmar Maurer 2018-12-22 15:59:55 +01:00
parent 176e4af964
commit 28b96b56e1
1 changed files with 5 additions and 2 deletions

View File

@ -109,8 +109,11 @@ pub fn open_file_locked<P: AsRef<Path>>(path: P, timeout: Duration)
Err(err) => bail!("Unable to open lock {:?} - {}",
path, err),
};
lock_file(&mut file, true, Some(timeout))?;
Ok(file)
match lock_file(&mut file, true, Some(timeout)) {
Ok(_) => Ok(file),
Err(err) => bail!("Unable to aquire lock {:?} - {}",
path, err),
}
}
// Note: We cannot implement an Iterator, because Iterators cannot