about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/Cargo.lock4
-rw-r--r--library/std/Cargo.toml2
-rw-r--r--library/std/src/sys/pal/unix/process/process_unix.rs17
3 files changed, 19 insertions, 4 deletions
diff --git a/library/Cargo.lock b/library/Cargo.lock
index 0be2f9a1549..6bc3cf4da9f 100644
--- a/library/Cargo.lock
+++ b/library/Cargo.lock
@@ -151,9 +151,9 @@ dependencies = [
 
 [[package]]
 name = "libc"
-version = "0.2.169"
+version = "0.2.170"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
+checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
 dependencies = [
  "rustc-std-workspace-core",
 ]
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
index 228ee6eea05..cec5cdbb92c 100644
--- a/library/std/Cargo.toml
+++ b/library/std/Cargo.toml
@@ -35,7 +35,7 @@ miniz_oxide = { version = "0.8.0", optional = true, default-features = false }
 addr2line = { version = "0.24.0", optional = true, default-features = false }
 
 [target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
-libc = { version = "0.2.169", default-features = false, features = [
+libc = { version = "0.2.170", default-features = false, features = [
     'rustc-dep-of-std',
 ], public = true }
 
diff --git a/library/std/src/sys/pal/unix/process/process_unix.rs b/library/std/src/sys/pal/unix/process/process_unix.rs
index aa7406dd548..7c5b0fca11a 100644
--- a/library/std/src/sys/pal/unix/process/process_unix.rs
+++ b/library/std/src/sys/pal/unix/process/process_unix.rs
@@ -410,6 +410,7 @@ impl Command {
 
     #[cfg(not(any(
         target_os = "freebsd",
+        target_os = "illumos",
         all(target_os = "linux", target_env = "gnu"),
         all(target_os = "linux", target_env = "musl"),
         target_os = "nto",
@@ -427,6 +428,7 @@ impl Command {
     // directly.
     #[cfg(any(
         target_os = "freebsd",
+        target_os = "illumos",
         all(target_os = "linux", target_env = "gnu"),
         all(target_os = "linux", target_env = "musl"),
         target_os = "nto",
@@ -584,6 +586,10 @@ impl Command {
         fn get_posix_spawn_addchdir() -> Option<PosixSpawnAddChdirFn> {
             use crate::sys::weak::weak;
 
+            // POSIX.1-2024 standardizes this function:
+            // https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_spawn_file_actions_addchdir.html.
+            // The _np version is more widely available, though, so try that first.
+
             weak! {
                 fn posix_spawn_file_actions_addchdir_np(
                     *mut libc::posix_spawn_file_actions_t,
@@ -591,7 +597,16 @@ impl Command {
                 ) -> libc::c_int
             }
 
-            posix_spawn_file_actions_addchdir_np.get()
+            weak! {
+                fn posix_spawn_file_actions_addchdir(
+                    *mut libc::posix_spawn_file_actions_t,
+                    *const libc::c_char
+                ) -> libc::c_int
+            }
+
+            posix_spawn_file_actions_addchdir_np
+                .get()
+                .or_else(|| posix_spawn_file_actions_addchdir.get())
         }
 
         /// Get the function pointer for adding a chdir action to a