Skip to content

Commit d0628e1

Browse files
committed
Merge #626
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.
2 parents e96de61 + c5a066b commit d0628e1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2323
([#614](https://github.com/nix-rust/nix/pull/614))
2424

2525
### Changed
26+
- Changed ioctl! write to take argument by value instead as pointer.
27+
If you need a pointer as argument, use ioctl! write buf.
28+
([#626](https://github.com/nix-rust/nix/pull/626))
2629
- Marked `sys::mman::{ mmap, munmap, madvise, munlock, msync }` as unsafe.
2730
([#559](https://github.com/nix-rust/nix/pull/559))
2831
- Minimum supported Rust version is now 1.13

src/sys/ioctl/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ macro_rules! ioctl {
158158
);
159159
(write $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
160160
pub unsafe fn $name(fd: $crate::sys::ioctl::libc::c_int,
161-
val: *const $ty)
161+
val: $ty)
162162
-> $crate::Result<$crate::sys::ioctl::libc::c_int> {
163163
convert_ioctl_res!($crate::sys::ioctl::ioctl(fd, iow!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::libc::c_ulong, val))
164164
}

0 commit comments

Comments
 (0)