formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-07-11 14:32:13 +02:00
parent 00c473c087
commit 942f3c7316
4 changed files with 14 additions and 12 deletions

View File

@ -7,13 +7,12 @@ use std::os::unix::ffi::{OsStrExt, OsStringExt};
use crate::pidfd::PidFd;
pub fn get_label(pidfd: &PidFd) -> io::Result<Option<OsString>> {
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());

View File

@ -47,7 +47,10 @@ pub struct ProcStatus {
impl PidFd {
pub fn current() -> io::Result<Self> {
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`.
///

View File

@ -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<SyscallStatus, Error> {
let mode = msg.arg_mode_t(1)?;

View File

@ -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),