X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmisc%2Fmodules.c;h=334e3a0cf9814349fa8381e92aa00ab6993e26b3;hb=ffa693e8bdac429c229fa679e64a8bd6cd6af15f;hp=d684b24c9ee7932f4e99b25226722486b55131e7;hpb=4542979c0fecaf06caebec3abd6b0060ede2f1d9;p=vlc diff --git a/src/misc/modules.c b/src/misc/modules.c index d684b24c9e..334e3a0cf9 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -105,7 +105,11 @@ void module_InitBank( module_bank_t * p_bank ) /* Parse the directory and try to load all files it contains. */ while( (file = readdir( dir )) ) { - if( memcmp( file->d_name, ".", 1 ) ) + int i_filelen = strlen( file->d_name ); + + /* We only load files ending with ".so" */ + if( i_filelen > 3 + && !strcmp( file->d_name + i_filelen - 3, ".so" ) ) { #ifdef SYS_BEOS /* Under BeOS, we need to add beos_GetProgramPath() to @@ -113,7 +117,7 @@ void module_InitBank( module_bank_t * p_bank ) if( memcmp( file->d_name, "/", 1 ) ) { psz_file = malloc( i_programlen + i_dirlen - + strlen( file->d_name ) + 3 ); + + i_filelen + 3 ); if( psz_file == NULL ) { continue; @@ -124,15 +128,13 @@ void module_InitBank( module_bank_t * p_bank ) else #endif { - psz_file = malloc( i_dirlen - + strlen( file->d_name ) + 2 ); + psz_file = malloc( i_dirlen + i_filelen + 2 ); if( psz_file == NULL ) { continue; } sprintf( psz_file, "%s/%s", *ppsz_path, file->d_name ); } - /* We created a nice filename -- now we just try to load * it as a dynamic module. */ AllocateDynModule( p_bank, psz_file );