Skip to content

Commit 7f18847

Browse files
bors[bot]SteveLauC
andauthored
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 <[email protected]>
2 parents 67f7d46 + 2f546c9 commit 7f18847

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/kmod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! For more details see
44
55
use std::ffi::CStr;
6-
use std::os::unix::io::AsRawFd;
6+
use std::os::unix::io::{AsFd, AsRawFd};
77

88
use crate::errno::Errno;
99
use crate::Result;
@@ -79,15 +79,15 @@ libc_bitflags!(
7979
/// ```
8080
///
8181
/// See [`man init_module(2)`](https://man7.org/linux/man-pages/man2/init_module.2.html) for more information.
82-
pub fn finit_module<T: AsRawFd>(
83-
fd: &T,
82+
pub fn finit_module<Fd: AsFd>(
83+
fd: &Fd,
8484
param_values: &CStr,
8585
flags: ModuleInitFlags,
8686
) -> Result<()> {
8787
let res = unsafe {
8888
libc::syscall(
8989
libc::SYS_finit_module,
90-
fd.as_raw_fd(),
90+
fd.as_fd().as_raw_fd(),
9191
param_values.as_ptr(),
9292
flags.bits(),
9393
)

0 commit comments

Comments
 (0)