]> git.lizzy.rs Git - rust.git/commitdiff
Fix build on i686-apple-darwin systems
authorMarcus Calhoun-Lopez <marcuscalhounlopez@gmail.com>
Mon, 28 Mar 2022 19:44:19 +0000 (12:44 -0700)
committerMarcus Calhoun-Lopez <marcuscalhounlopez@gmail.com>
Mon, 28 Mar 2022 19:52:14 +0000 (12:52 -0700)
On 32-bit systems, fdopendir is called `_fdopendir$INODE64$UNIX2003`.
On 64-bit systems, fdopendir is called `_fdopendir$INODE64`.

library/std/src/sys/unix/fs.rs

index 6a0088a8940dc454a33446d0a29b972ba40346a1..7181451de575fcb8ff7df27ba5a66b18a08904be 100644 (file)
@@ -1562,6 +1562,9 @@ pub unsafe fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_i
         }
 
         pub unsafe fn fdopendir(fd: c_int) -> *mut DIR {
+            #[cfg(all(target_os = "macos", target_arch = "x86"))]
+            weak!(fn fdopendir(c_int) -> *mut DIR, "fdopendir$INODE64$UNIX2003");
+            #[cfg(all(target_os = "macos", target_arch = "x86_64"))]
             weak!(fn fdopendir(c_int) -> *mut DIR, "fdopendir$INODE64");
             fdopendir.get().map(|fdopendir| fdopendir(fd)).unwrap_or_else(|| {
                 crate::sys::unix::os::set_errno(libc::ENOSYS);