Skip to content

Commit da5065c

Browse files
committed
Merge branch 'bugfix-13132' into develop
2 parents 14a848b + b26aefb commit da5065c

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

docs/notes/bugfix-13132.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# put the engine folder crashes in OSX 10.6

engine/src/osxfiles.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ char *path2utf(char *path);
8484

8585
void MCS_setfiletype(const char *newpath);
8686

87+
// PM-2014-08-08: [[ Bug 13132 ]] OSX 10.6 does not contain an implementation for strndup so use our own regardless of the OSX version
88+
static char *my_strndup(const char *s, uint32_t l)
89+
{
90+
char *r;
91+
r = new char[l + 1];
92+
strncpy(r, s, l);
93+
r[l] = '\0';
94+
return r;
95+
}
8796

8897
/********************************************************************/
8998
/* File Handling */
@@ -2047,7 +2056,7 @@ void MCS_getspecialfolder(MCExecPoint &p_context)
20472056
{
20482057
extern char *MCcmd;
20492058
char* t_folder;
2050-
t_folder_path = strndup(MCcmd, strrchr(MCcmd, '/') - MCcmd);
2059+
t_folder_path = my_strndup(MCcmd, strrchr(MCcmd, '/') - MCcmd);
20512060

20522061
t_mac_folder = 0;
20532062
t_found_folder = true;

0 commit comments

Comments
 (0)