File tree 1 file changed +13
-2
lines changed
src/native/libs/System.Native 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 54
54
#endif
55
55
#endif
56
56
57
+ #ifdef TARGET_SUNOS
58
+ #include <sys/param.h>
59
+ #endif
60
+
57
61
#ifdef _AIX
58
62
#include <alloca.h>
59
63
// Somehow, AIX mangles the definition for this behind a C++ def
@@ -436,10 +440,17 @@ static const size_t dirent_alignment = 8;
436
440
int32_t SystemNative_GetReadDirRBufferSize (void )
437
441
{
438
442
#if HAVE_READDIR_R
443
+ size_t result = sizeof (struct dirent );
444
+ #ifdef TARGET_SUNOS
445
+ // The d_name array is declared with only a single byte in it.
446
+ // We have to add pathconf("dir", _PC_NAME_MAX) more bytes.
447
+ // MAXNAMELEN is the largest possible value returned from pathconf.
448
+ result += MAXNAMELEN ;
449
+ #endif
439
450
// dirent should be under 2k in size
440
- assert (sizeof ( struct dirent ) < 2048 );
451
+ assert (result < 2048 );
441
452
// add some extra space so we can align the buffer to dirent.
442
- return sizeof ( struct dirent ) + dirent_alignment - 1 ;
453
+ return ( int32_t )( result + dirent_alignment - 1 ) ;
443
454
#else
444
455
return 0 ;
445
456
#endif
You can’t perform that action at this time.
0 commit comments