minor style fixes

This commit is contained in:
edef 2016-03-16 00:20:45 +01:00
parent bb2b92bf6b
commit 4ffdba3ea6
2 changed files with 7 additions and 7 deletions

View File

@ -36,9 +36,10 @@ impl Stack {
Stack { ptr: ptr as *mut u8, len: len } Stack { ptr: ptr as *mut u8, len: len }
}; };
try!(unsafe { try!(if unsafe { sys::protect_stack(stack.ptr) } {
if sys::protect_stack(stack.ptr) { Ok(()) } Ok(())
else { Err(IoError::last_os_error()) } } else {
Err(IoError::last_os_error())
}); });
Ok(stack) Ok(stack)

View File

@ -32,11 +32,10 @@ const STACK_FLAGS: c_int = libc::MAP_PRIVATE
pub unsafe fn map_stack(len: usize) -> Option<*mut u8> { pub unsafe fn map_stack(len: usize) -> Option<*mut u8> {
let ptr = mmap(ptr::null_mut(), len as size_t, let ptr = mmap(ptr::null_mut(), len as size_t,
STACK_PROT, STACK_FLAGS, -1, 0); STACK_PROT, STACK_FLAGS, -1, 0);
if ptr != MAP_FAILED { if ptr == MAP_FAILED {
Some(ptr as *mut u8)
}
else {
None None
} else {
Some(ptr as *mut u8)
} }
} }