diff options
author | Bastian Köcher <bastian@superscale.io> | 2017-06-21 13:32:31 +0200 |
---|---|---|
committer | Bastian Köcher <git@kchr.de> | 2017-07-05 21:52:19 +0200 |
commit | c5a066bed453b93bbf7b1a975690671bbd219400 (patch) | |
tree | 8f24fad62085197dae9e0b0289446cc77e08e0b9 | |
parent | e96de619df03fc3a2926153d8d32ae87f1eda186 (diff) | |
download | nix-c5a066bed453b93bbf7b1a975690671bbd219400.zip |
We need to pass by value and not by pointer for writing ioctls
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | src/sys/ioctl/mod.rs | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e44306f..c0fb9e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/sys/ioctl/mod.rs b/src/sys/ioctl/mod.rs index 0a95ec77..48b3827b 100644 --- a/src/sys/ioctl/mod.rs +++ b/src/sys/ioctl/mod.rs @@ -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)) } |