cargo fmt --all

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-06-12 09:43:50 +02:00
parent 71f2d48c2e
commit 024930f63c
3 changed files with 3 additions and 5 deletions

View File

@ -1,4 +1,3 @@
//! This is a system utility crate used by all our rust projects.
pub mod linux;

View File

@ -5,7 +5,6 @@ use proxmox_tools as tools;
/// Get pseudo random data (/dev/urandom)
pub fn random_data(size: usize) -> Result<Vec<u8>, Error> {
let mut buffer = tools::vec::undefined(size);
fill_with_random_data(&mut buffer)?;
@ -16,7 +15,6 @@ pub fn random_data(size: usize) -> Result<Vec<u8>, Error> {
///
/// This code uses the Linux syscall getrandom() - see "man 2 getrandom".
pub fn fill_with_random_data(buffer: &mut [u8]) -> Result<(), Error> {
let res = unsafe {
libc::syscall(
libc::SYS_getrandom,
@ -30,7 +28,8 @@ pub fn fill_with_random_data(buffer: &mut [u8]) -> Result<(), Error> {
return Err(std::io::Error::last_os_error().into());
}
if res as usize != buffer.len() { // should not happen
if res as usize != buffer.len() {
// should not happen
bail!("short getrandom read");
}

View File

@ -1,5 +1,5 @@
pub use proxmox_tools as tools;
pub use proxmox_sys as sys;
pub use proxmox_tools as tools;
// Both `proxmox_api` and the 2 macros from `proxmox_api_macro` should be
// exposed via `proxmox::api`.