]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Solaris 11: fix for VG_(lstat)
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 6 Sep 2025 14:49:10 +0000 (16:49 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 6 Sep 2025 14:49:10 +0000 (16:49 +0200)
This function was using SYS_lstat. It works OK with illumos
but not Solaris 11+ which has removed that syscall.

Instead do like Linux and FreeBSD, use SYS_fstatat with the flag
for no follow link.

coregrind/m_libcfile.c
include/vki/vki-solaris.h

index 6addb876106ad4468fa121cd0e0e4b8e1c5285a9..ea8a56b9c335311525ba81424d2929bdb246d7f6 100644 (file)
@@ -700,9 +700,20 @@ struct vki_stat buf;
    res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW);
 #endif
 
+#elif defined(VGO_solaris)
+
+   struct vki_stat buf;
+#if defined(SOLARIS_OLD_SYSCALLS)
+   // illumos
+   res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf);
+#else
+   // Solaris 11+
+   res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW);
+#endif
+
 #else
 
-   /* check this on illumos and Darwin */
+   /* check this on Darwin */
    struct vki_stat buf;
    res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf);
 
index 9c96ed19e1facff59be145997c6c010208e8bec7..18d9767009dcd0cfb349c691b10192b14efbccdc 100644 (file)
@@ -100,6 +100,7 @@ typedef uint32_t vki_u32;
 
 #include <fcntl.h>
 #define VKI_SEEK_SET SEEK_SET
+#define VKI_AT_SYMLINK_NOFOLLOW AT_SYMLINK_NOFOLLOW
 
 
 #include <limits.h>