Skip to content

Commit 172d9fa

Browse files
committed
WIP: Port file_open_tmp (needs verification)
1 parent 6201b60 commit 172d9fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

glib/src/functions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ use std::boxed::Box as Box_;
66
use std::mem;
77
#[cfg(not(windows))]
88
#[cfg(any(feature = "v2_58", feature = "dox"))]
9-
use std::os::unix::io::AsRawFd;
9+
use std::os::unix::io::{AsFd, AsRawFd};
1010
#[cfg(not(windows))]
11-
use std::os::unix::io::{AsFd, FromRawFd, IntoRawFd, RawFd};
11+
use std::os::unix::io::{FromRawFd, OwnedFd, RawFd};
1212
use std::ptr;
1313

1414
// #[cfg(windows)]
@@ -243,7 +243,7 @@ pub fn unix_open_pipe(flags: i32) -> Result<(RawFd, RawFd), Error> {
243243
#[doc(alias = "g_file_open_tmp")]
244244
pub fn file_open_tmp(
245245
tmpl: Option<impl AsRef<std::path::Path>>,
246-
) -> Result<(RawFd, std::path::PathBuf), crate::Error> {
246+
) -> Result<(OwnedFd, std::path::PathBuf), crate::Error> {
247247
unsafe {
248248
let mut name_used = ptr::null_mut();
249249
let mut error = ptr::null_mut();
@@ -253,7 +253,7 @@ pub fn file_open_tmp(
253253
&mut error,
254254
);
255255
if error.is_null() {
256-
Ok((ret.into_raw_fd(), from_glib_full(name_used)))
256+
Ok((OwnedFd::from_raw_fd(ret), from_glib_full(name_used)))
257257
} else {
258258
Err(from_glib_full(error))
259259
}

0 commit comments

Comments
 (0)