Skip to content

Commit e978ca4

Browse files
committed
Port file_open_tmp to safe-io
1 parent 72a9cbd commit e978ca4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

glib/src/functions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::mem;
99
#[cfg(feature = "v2_58")]
1010
use std::os::unix::io::{AsFd, AsRawFd};
1111
#[cfg(not(windows))]
12-
use std::os::unix::io::{FromRawFd, IntoRawFd, RawFd};
12+
use std::os::unix::io::{FromRawFd, OwnedFd, RawFd};
1313
use std::ptr;
1414

1515
// #[cfg(windows)]
@@ -261,7 +261,7 @@ pub fn unix_open_pipe(flags: i32) -> Result<(RawFd, RawFd), Error> {
261261
#[doc(alias = "g_file_open_tmp")]
262262
pub fn file_open_tmp(
263263
tmpl: Option<impl AsRef<std::path::Path>>,
264-
) -> Result<(RawFd, std::path::PathBuf), crate::Error> {
264+
) -> Result<(OwnedFd, std::path::PathBuf), crate::Error> {
265265
unsafe {
266266
let mut name_used = ptr::null_mut();
267267
let mut error = ptr::null_mut();
@@ -271,7 +271,7 @@ pub fn file_open_tmp(
271271
&mut error,
272272
);
273273
if error.is_null() {
274-
Ok((ret.into_raw_fd(), from_glib_full(name_used)))
274+
Ok((OwnedFd::from_raw_fd(ret), from_glib_full(name_used)))
275275
} else {
276276
Err(from_glib_full(error))
277277
}

0 commit comments

Comments
 (0)