mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 10:31:14 -03:00
Remove unnecessary use of errno
This commit is contained in:
@@ -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<File> {
|
||||
// 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) => {
|
||||
|
||||
Reference in New Issue
Block a user