diff --git a/neo/idlib/sys/posix/posix_thread.cpp b/neo/idlib/sys/posix/posix_thread.cpp index e9bc68d8..ac0a51e4 100644 --- a/neo/idlib/sys/posix/posix_thread.cpp +++ b/neo/idlib/sys/posix/posix_thread.cpp @@ -277,11 +277,12 @@ Sys_Yield */ void Sys_Yield() { -#if defined(__ANDROID__) || defined(__APPLE__) +// SRS - pthread_yield() is deprecated on linux +//#if defined(__ANDROID__) || defined(__APPLE__) sched_yield(); -#else - pthread_yield(); -#endif +//#else +// pthread_yield(); +//#endif } /* diff --git a/neo/sys/posix/platform_linux.cpp b/neo/sys/posix/platform_linux.cpp index de57bd58..6a64df04 100644 --- a/neo/sys/posix/platform_linux.cpp +++ b/neo/sys/posix/platform_linux.cpp @@ -449,9 +449,11 @@ void Sys_ReLaunch() DIR* devfd = opendir( "/dev/fd" ); if( devfd != NULL ) { - struct dirent entry; + //struct dirent entry; struct dirent* result; - while( readdir_r( devfd, &entry, &result ) == 0 ) + //while( readdir_r( devfd, &entry, &result ) == 0 ) + // SRS - readdir_r() is deprecated on linux, readdir() is thread safe with different dir streams + while( ( result = readdir( devfd ) ) != NULL ) { const char* filename = result->d_name; char* endptr = NULL; diff --git a/neo/sys/posix/platform_osx.cpp b/neo/sys/posix/platform_osx.cpp index 83d72c3e..814ea783 100644 --- a/neo/sys/posix/platform_osx.cpp +++ b/neo/sys/posix/platform_osx.cpp @@ -345,9 +345,11 @@ void Sys_ReLaunch() DIR* devfd = opendir( "/dev/fd" ); if( devfd != NULL ) { - struct dirent entry; + //struct dirent entry; struct dirent* result; - while( readdir_r( devfd, &entry, &result ) == 0 ) + //while( readdir_r( devfd, &entry, &result ) == 0 ) + // SRS - readdir_r() is deprecated on linux, readdir() is thread safe with different dir streams + while( ( result = readdir( devfd ) ) != NULL ) { const char* filename = result->d_name; char* endptr = NULL; diff --git a/neo/sys/posix/posix_main.cpp b/neo/sys/posix/posix_main.cpp index 72c80336..e7926618 100644 --- a/neo/sys/posix/posix_main.cpp +++ b/neo/sys/posix/posix_main.cpp @@ -594,23 +594,25 @@ int Sys_ListFiles( const char* directory, const char* extension, idStrList& list // DG: use readdir_r instead of readdir for thread safety // the following lines are from the readdir_r manpage.. fscking ugly. - int nameMax = pathconf( directory, _PC_NAME_MAX ); - if( nameMax == -1 ) - { - nameMax = 255; - } - int direntLen = offsetof( struct dirent, d_name ) + nameMax + 1; + //int nameMax = pathconf( directory, _PC_NAME_MAX ); + //if( nameMax == -1 ) + //{ + // nameMax = 255; + //} + //int direntLen = offsetof( struct dirent, d_name ) + nameMax + 1; - struct dirent* entry = ( struct dirent* )Mem_Alloc( direntLen, TAG_CRAP ); + //struct dirent* entry = ( struct dirent* )Mem_Alloc( direntLen, TAG_CRAP ); - if( entry == NULL ) - { - common->Warning( "Sys_ListFiles: Mem_Alloc for entry failed!" ); - closedir( fdir ); - return 0; - } + //if( entry == NULL ) + //{ + // common->Warning( "Sys_ListFiles: Mem_Alloc for entry failed!" ); + // closedir( fdir ); + // return 0; + //} - while( readdir_r( fdir, entry, &d ) == 0 && d != NULL ) + //while( readdir_r( fdir, entry, &d ) == 0 && d != NULL ) + // SRS - readdir_r() is deprecated on linux, readdir() is thread safe with different dir streams + while( ( d = readdir( fdir ) ) != NULL ) { // DG end idStr::snPrintf( search, sizeof( search ), "%s/%s", directory, d->d_name ); @@ -640,7 +642,7 @@ int Sys_ListFiles( const char* directory, const char* extension, idStrList& list } closedir( fdir ); - Mem_Free( entry ); + //Mem_Free( entry ); if( debug ) {