Give it a better chance to work on MacOS X

This commit is contained in:
Pierre Pronchery 2012-10-18 15:14:20 +00:00
parent 8675979447
commit 03e47517ee

View File

@ -166,7 +166,11 @@ static AsmFormat * _new_file_format(char const * filename, FILE * fp)
DIR * dir; DIR * dir;
struct dirent * de; struct dirent * de;
size_t len; size_t len;
#ifdef __APPLE__
char const ext[] = ".dylib";
#else
char const ext[] = ".so"; char const ext[] = ".so";
#endif
int hasflat = 0; int hasflat = 0;
AsmFormat * format = NULL; AsmFormat * format = NULL;
@ -180,7 +184,7 @@ static AsmFormat * _new_file_format(char const * filename, FILE * fp)
} }
while((de = readdir(dir)) != NULL) while((de = readdir(dir)) != NULL)
{ {
if((len = strlen(de->d_name)) < 4) if((len = strlen(de->d_name)) < sizeof(ext))
continue; continue;
if(strcmp(&de->d_name[len - sizeof(ext) + 1], ext) != 0) if(strcmp(&de->d_name[len - sizeof(ext) + 1], ext) != 0)
continue; continue;