@@ -78,7 +78,7 @@ int eaccess();
78
78
#endif
79
79
80
80
#ifndef FUNCNAME_PATTERN
81
- # if defined(__hp9000s300 ) || (defined(__NetBSD__ ) && (!defined(__alpha__ ) && !defined(__mips__ ))) || defined(__BORLANDC__ ) || (defined(__FreeBSD__ ) && __FreeBSD__ < 3 ) || defined(NeXT ) || defined(__WATCOMC__ )
81
+ # if defined(__hp9000s300 ) || (defined(__NetBSD__ ) && (!defined(__alpha__ ) && !defined(__mips__ ))) || defined(__BORLANDC__ ) || (defined(__FreeBSD__ ) && __FreeBSD__ < 3 ) || defined(NeXT ) || defined(__WATCOMC__ ) || defined( __APPLE__ )
82
82
# define FUNCNAME_PATTERN "_Init_%.200s"
83
83
# else
84
84
# define FUNCNAME_PATTERN "Init_%.200s"
@@ -1095,6 +1095,10 @@ dln_sym(name)
1095
1095
#include <mach-o/dyld.h>
1096
1096
#endif
1097
1097
#endif
1098
+ #ifdef __APPLE__
1099
+ #include <mach-o/dyld.h>
1100
+ #endif
1101
+
1098
1102
1099
1103
#ifdef _WIN32
1100
1104
#include <windows.h>
@@ -1356,7 +1360,7 @@ dln_load(file)
1356
1360
}
1357
1361
#endif /* _AIX */
1358
1362
1359
- #ifdef NeXT
1363
+ #if defined( NeXT ) || defined( __APPLE__ )
1360
1364
#define DLN_DEFINED
1361
1365
/*----------------------------------------------------
1362
1366
By SHIROYAMA Takayuki Psi@fortune.nest.or.jp
@@ -1366,7 +1370,8 @@ dln_load(file)
1366
1370
Mi hisho@tasihara.nest.or.jp,
1367
1371
and... Miss ARAI Akino(^^;)
1368
1372
----------------------------------------------------*/
1369
- #if NS_TARGET_MAJOR < 4 /* NeXTSTEP rld functions */
1373
+ #if defined(NeXT ) && ( NS_TARGET_MAJOR < 4 )/* NeXTSTEP rld functions */
1374
+
1370
1375
{
1371
1376
unsigned long init_address ;
1372
1377
char * object_files [2 ] = {NULL , NULL };
@@ -1572,9 +1577,10 @@ dln_find_file(fname, path)
1572
1577
1573
1578
#if defined(__CYGWIN32__ )
1574
1579
const char *
1575
- conv_to_posix_path (win32 , posix )
1580
+ conv_to_posix_path (win32 , posix , len )
1576
1581
char * win32 ;
1577
1582
char * posix ;
1583
+ int len ;
1578
1584
{
1579
1585
char * first = win32 ;
1580
1586
char * p = win32 ;
@@ -1589,7 +1595,10 @@ conv_to_posix_path(win32, posix)
1589
1595
first = p + 1 ;
1590
1596
* p = ';' ;
1591
1597
}
1592
- cygwin32_conv_to_posix_path (first , posix );
1598
+ if (len < strlen (first ))
1599
+ fprintf (stderr , "PATH length too long: %s\n" , first );
1600
+ else
1601
+ strcpy (posix , first );
1593
1602
return dst ;
1594
1603
}
1595
1604
#endif
@@ -1612,8 +1621,10 @@ dln_find_1(fname, path, exe_flag)
1612
1621
#endif
1613
1622
1614
1623
#if defined(__CYGWIN32__ )
1615
- char rubypath [MAXPATHLEN ];
1616
- conv_to_posix_path (path , rubypath );
1624
+ int pathlen = 2 * strlen (path );
1625
+ int rubypathlen = pathlen > MAXPATHLEN ? pathlen : MAXPATHLEN ;
1626
+ char * rubypath = alloca (rubypathlen );
1627
+ conv_to_posix_path (path , rubypath , rubypathlen );
1617
1628
path = rubypath ;
1618
1629
#endif
1619
1630
if (fname [0 ] == '/' ) return fname ;
0 commit comments