mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-20 03:44:18 +08:00
23 lines
967 B
Diff
23 lines
967 B
Diff
diff --git a/stdlib/src/posixsubprocess.rs b/stdlib/src/posixsubprocess.rs
|
|
index 7f418c899..4da6a6858 100644
|
|
--- a/stdlib/src/posixsubprocess.rs
|
|
+++ b/stdlib/src/posixsubprocess.rs
|
|
@@ -441,15 +441,14 @@ fn close_dir_fds(keep: KeepFds<'_>) -> nix::Result<()> {
|
|
fn close_filetable_fds(keep: KeepFds<'_>) -> nix::Result<()> {
|
|
use nix::fcntl;
|
|
use std::os::fd::{FromRawFd, OwnedFd};
|
|
- let fd = fcntl::open(
|
|
+ let filetable = fcntl::open(
|
|
c"/scheme/thisproc/current/filetable",
|
|
fcntl::OFlag::O_RDONLY,
|
|
nix::sys::stat::Mode::empty(),
|
|
)?;
|
|
- let filetable = unsafe { OwnedFd::from_raw_fd(fd) };
|
|
let read_one = || -> nix::Result<_> {
|
|
let mut byte = 0;
|
|
- let n = nix::unistd::read(filetable.as_raw_fd(), std::slice::from_mut(&mut byte))?;
|
|
+ let n = nix::unistd::read(&filetable, std::slice::from_mut(&mut byte))?;
|
|
Ok((n > 0).then_some(byte))
|
|
};
|
|
while let Some(c) = read_one()? {
|