Skip to content

Commit

Permalink
Merge #626
Browse files Browse the repository at this point in the history
626: Use pass by value for write ioctls r=posborne

The kernel expects that the values are passed by value and not by pointer for writing ioctls.
  • Loading branch information
bors[bot] committed Jul 6, 2017
2 parents e96de61 + c5a066b commit d0628e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
([#614](https://github.com/nix-rust/nix/pull/614))

### Changed
- Changed ioctl! write to take argument by value instead as pointer.
If you need a pointer as argument, use ioctl! write buf.
([#626](https://github.com/nix-rust/nix/pull/626))
- Marked `sys::mman::{ mmap, munmap, madvise, munlock, msync }` as unsafe.
([#559](https://github.com/nix-rust/nix/pull/559))
- Minimum supported Rust version is now 1.13
Expand Down
2 changes: 1 addition & 1 deletion src/sys/ioctl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ macro_rules! ioctl {
);
(write $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
pub unsafe fn $name(fd: $crate::sys::ioctl::libc::c_int,
val: *const $ty)
val: $ty)
-> $crate::Result<$crate::sys::ioctl::libc::c_int> {
convert_ioctl_res!($crate::sys::ioctl::ioctl(fd, iow!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::libc::c_ulong, val))
}
Expand Down

0 comments on commit d0628e1

Please sign in to comment.