diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-12-08 04:12:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-08 04:12:59 +0000 |
commit | 7f18847f4d59390698c62e2fd5a609cef2439673 (patch) | |
tree | 89c41b7cb16953b71925efd5064d59d167daf4b7 | |
parent | 67f7d46c6e9d2089f03b2322d31dcb4b388eb730 (diff) | |
parent | 2f546c98cb1abb4463f13b084443ae4bf1597cb3 (diff) | |
download | nix-7f18847f4d59390698c62e2fd5a609cef2439673.zip |
Merge #1922
1922: feat: I/O safety for 'kmod' r=asomers a=SteveLauC
#### What this PR does:
1. Adds I/O safety for module `kmod`.
Co-authored-by: Steve Lau <stevelauc@outlook.com>
-rw-r--r-- | src/kmod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/kmod.rs b/src/kmod.rs index 1fa6c170..d7146612 100644 --- a/src/kmod.rs +++ b/src/kmod.rs @@ -3,7 +3,7 @@ //! For more details see use std::ffi::CStr; -use std::os::unix::io::AsRawFd; +use std::os::unix::io::{AsFd, AsRawFd}; use crate::errno::Errno; use crate::Result; @@ -79,15 +79,15 @@ libc_bitflags!( /// ``` /// /// See [`man init_module(2)`](https://man7.org/linux/man-pages/man2/init_module.2.html) for more information. -pub fn finit_module<T: AsRawFd>( - fd: &T, +pub fn finit_module<Fd: AsFd>( + fd: &Fd, param_values: &CStr, flags: ModuleInitFlags, ) -> Result<()> { let res = unsafe { libc::syscall( libc::SYS_finit_module, - fd.as_raw_fd(), + fd.as_fd().as_raw_fd(), param_values.as_ptr(), flags.bits(), ) |