Files
RedBear-OS/local/patches/relibc/redox.patch
T

24 lines
705 B
Diff

diff --git a/src/header/fcntl/mod.rs b/src/header/fcntl/mod.rs
--- a/src/header/fcntl/mod.rs
+++ b/src/header/fcntl/mod.rs
@@ -9,0 +10 @@
+ header::unistd::close,
@@ -75,0 +77,17 @@
+
+ if cmd == F_DUPFD_CLOEXEC {
+ let new_fd = Sys::fcntl(fildes, F_DUPFD_CLOEXEC, arg).or_minus_one_errno();
+ if new_fd >= 0 {
+ return new_fd;
+ }
+
+ let new_fd = Sys::fcntl(fildes, F_DUPFD, arg).or_minus_one_errno();
+ if new_fd < 0 {
+ return -1;
+ }
+ if Sys::fcntl(new_fd, F_SETFD, FD_CLOEXEC as c_ulonglong).or_minus_one_errno() < 0 {
+ let _ = close(new_fd);
+ return -1;
+ }
+ return new_fd;
+ }