ad9254e489
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
54 lines
1.6 KiB
Diff
54 lines
1.6 KiB
Diff
diff --git a/src/c/stdlib.c b/src/c/stdlib.c
|
|
index 62e98108..a9c72392 100644
|
|
--- a/src/c/stdlib.c
|
|
+++ b/src/c/stdlib.c
|
|
@@ -4,6 +4,13 @@ long double strtold(const char *nptr, char **endptr) {
|
|
return (long double)strtod(nptr, endptr);
|
|
}
|
|
|
|
+long double relibc_compat_cpp_strtold(const char *nptr, char **endptr)
|
|
+ __asm__("_Z7strtoldPKcPPc");
|
|
+
|
|
+long double relibc_compat_cpp_strtold(const char *nptr, char **endptr) {
|
|
+ return strtold(nptr, endptr);
|
|
+}
|
|
+
|
|
double relibc_ldtod(const long double* val) {
|
|
return (double)(*val);
|
|
}
|
|
diff --git a/src/header/fcntl/mod.rs b/src/header/fcntl/mod.rs
|
|
index ec37906c..95604e06 100644
|
|
--- a/src/header/fcntl/mod.rs
|
|
+++ b/src/header/fcntl/mod.rs
|
|
@@ -8,6 +8,7 @@ use crate::{
|
|
c_str::CStr,
|
|
error::{Errno, ResultExt},
|
|
header::errno::ENAMETOOLONG,
|
|
+ header::unistd::close,
|
|
platform::{
|
|
Pal, Sys,
|
|
types::{
|
|
@@ -78,6 +79,23 @@ pub unsafe extern "C" fn fcntl(fildes: c_int, cmd: c_int, mut __valist: ...) ->
|
|
_ => 0,
|
|
};
|
|
|
|
+ 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;
|
|
+ }
|
|
+
|
|
Sys::fcntl(fildes, cmd, arg).or_minus_one_errno()
|
|
}
|