From edfdf210c4312455c27a77d93cab45ebe5dc1cff Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Wed, 1 Jan 2025 21:45:07 +0100 Subject: [PATCH] Remove unnecessary use of errno --- src/fds.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/fds.rs b/src/fds.rs index f5a4c6ab7..fbc7507db 100644 --- a/src/fds.rs +++ b/src/fds.rs @@ -5,7 +5,6 @@ use crate::tests::prelude::*; use crate::wchar::prelude::*; use crate::wutil::perror; -use errno::{errno, set_errno}; use libc::{c_int, EINTR, FD_CLOEXEC, F_GETFD, F_GETFL, F_SETFD, F_SETFL, O_NONBLOCK}; use nix::fcntl::FcntlArg; use nix::{fcntl::OFlag, unistd}; @@ -234,8 +233,6 @@ pub fn wopen_cloexec( pub fn open_cloexec(path: &CStr, flags: OFlag, mode: nix::sys::stat::Mode) -> nix::Result { // Port note: the C++ version of this function had a fallback for platforms where // O_CLOEXEC is not supported, using fcntl. In 2023, this is no longer needed. - let saved_errno = errno(); - errno::set_errno(errno::Errno(0)); // We retry this in case of signals, // if we get EINTR and it's not a SIGINT, we continue. // If it is that's our cancel signal, so we abort. @@ -244,7 +241,6 @@ pub fn open_cloexec(path: &CStr, flags: OFlag, mode: nix::sys::stat::Mode) -> ni let ret = ret.map(|raw_fd| unsafe { File::from_raw_fd(raw_fd) }); match ret { Ok(file) => { - set_errno(saved_errno); return Ok(file); } Err(err) => {