Skip to content

Commit

Permalink
We need to pass by value and not by pointer for writing ioctls
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastian Köcher authored and bkchr committed Jul 5, 2017
1 parent e96de61 commit c5a066b
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 c5a066b

Please sign in to comment.