From 942f3c73165dd5663f29fcc802e133d1721e22ef Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 11 Jul 2019 14:32:13 +0200 Subject: [PATCH] formatting fixup Signed-off-by: Wolfgang Bumiller --- src/apparmor.rs | 15 +++++++-------- src/pidfd.rs | 7 +++++-- src/sys_mknod.rs | 2 +- src/syscall.rs | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/apparmor.rs b/src/apparmor.rs index b8e3cc5..b2a6a0c 100644 --- a/src/apparmor.rs +++ b/src/apparmor.rs @@ -7,13 +7,12 @@ use std::os::unix::ffi::{OsStrExt, OsStringExt}; use crate::pidfd::PidFd; pub fn get_label(pidfd: &PidFd) -> io::Result> { - let mut out = match pidfd.read_file(unsafe { - CStr::from_bytes_with_nul_unchecked(b"attr/current\0") - }) { - Ok(out) => out, - Err(ref e) if e.raw_os_error() == Some(libc::EINVAL) => return Ok(None), - Err(other) => return Err(other.into()), - }; + let mut out = + match pidfd.read_file(unsafe { CStr::from_bytes_with_nul_unchecked(b"attr/current\0") }) { + Ok(out) => out, + Err(ref e) if e.raw_os_error() == Some(libc::EINVAL) => return Ok(None), + Err(other) => return Err(other.into()), + }; if out.len() == 0 { return Err(io::ErrorKind::UnexpectedEof.into()); @@ -30,7 +29,7 @@ pub fn set_label(pidfd: &PidFd, label: &OsStr) -> io::Result<()> { let mut file = pidfd.open_file( unsafe { CStr::from_bytes_with_nul_unchecked(b"attr/current\0") }, libc::O_RDWR | libc::O_CLOEXEC, - 0 + 0, )?; let mut bytes = Vec::with_capacity(14 + label.len()); diff --git a/src/pidfd.rs b/src/pidfd.rs index f3037c7..4001be0 100644 --- a/src/pidfd.rs +++ b/src/pidfd.rs @@ -47,7 +47,10 @@ pub struct ProcStatus { impl PidFd { pub fn current() -> io::Result { let fd = libc_try!(unsafe { - libc::open(b"/proc/self\0".as_ptr() as _, libc::O_DIRECTORY | libc::O_CLOEXEC) + libc::open( + b"/proc/self\0".as_ptr() as _, + libc::O_DIRECTORY | libc::O_CLOEXEC, + ) }); Ok(Self(fd, unsafe { libc::getpid() })) @@ -369,7 +372,7 @@ impl Capabilities { /// affected, and access to devices as well. /// /// Then we must enter the mount namespace, chroot and current working directory, in order to get -/// the correct view of paths. +/// the correct view of paths. /// /// Next we copy the caller's `umask`. /// diff --git a/src/sys_mknod.rs b/src/sys_mknod.rs index 370bc52..4c39317 100644 --- a/src/sys_mknod.rs +++ b/src/sys_mknod.rs @@ -7,9 +7,9 @@ use nix::sys::stat; use crate::fork::forking_syscall; use crate::lxcseccomp::ProxyMessageBuffer; use crate::pidfd::PidFd; +use crate::sc_libc_try; use crate::syscall::SyscallStatus; use crate::tools::Fd; -use crate::sc_libc_try; pub async fn mknod(msg: &ProxyMessageBuffer) -> Result { let mode = msg.arg_mode_t(1)?; diff --git a/src/syscall.rs b/src/syscall.rs index 1a43600..9a955d5 100644 --- a/src/syscall.rs +++ b/src/syscall.rs @@ -8,7 +8,7 @@ use crate::lxcseccomp::ProxyMessageBuffer; use crate::tools::vec; const AUDIT_ARCH_X86_64: u32 = 0xc000003e; -const AUDIT_ARCH_I386: u32 = 0x40000003; +const AUDIT_ARCH_I386: u32 = 0x40000003; pub enum SyscallStatus { Ok(i64),