Skip to content
Snippets Groups Projects
Commit c76ce4dd authored by Moe Jette's avatar Moe Jette
Browse files

Only attempt to dlopen() files with names containing ".so". There are

an assortment of other files in the installation lib/slurm directory
that we don't want to bother trying to open and report errors for.
parent 5563a721
No related branches found
No related tags found
No related merge requests found
...@@ -69,6 +69,7 @@ char *strchr(), *strrchr(); ...@@ -69,6 +69,7 @@ char *strchr(), *strrchr();
# include <sys/stat.h> # include <sys/stat.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include "src/common/macros.h"
#include "src/common/xassert.h" #include "src/common/xassert.h"
#include "src/common/xmalloc.h" #include "src/common/xmalloc.h"
#include "src/common/xstring.h" #include "src/common/xstring.h"
...@@ -120,6 +121,7 @@ struct _plugrack { ...@@ -120,6 +121,7 @@ struct _plugrack {
#define PLUGRACK_UID_NOBODY 99 /* RedHat's, anyway. */ #define PLUGRACK_UID_NOBODY 99 /* RedHat's, anyway. */
static int _plugrack_read_single_dir( plugrack_t rack, char *dir ); static int _plugrack_read_single_dir( plugrack_t rack, char *dir );
static bool _so_file( char *pathname );
/* /*
* Destructor function for the List code. This should entirely * Destructor function for the List code. This should entirely
...@@ -531,6 +533,9 @@ _plugrack_read_single_dir( plugrack_t rack, char *dir ) ...@@ -531,6 +533,9 @@ _plugrack_read_single_dir( plugrack_t rack, char *dir )
if ( stat( fq_path, &st ) < 0 ) continue; if ( stat( fq_path, &st ) < 0 ) continue;
if ( ! S_ISREG( st.st_mode ) ) continue; if ( ! S_ISREG( st.st_mode ) ) continue;
/* Check only shared object files. */
if ( ! _so_file( e->d_name) ) continue;
/* See if we should be paranoid about this file. */ /* See if we should be paranoid about this file. */
if (!accept_path_paranoia( rack, if (!accept_path_paranoia( rack,
fq_path, fq_path,
...@@ -566,6 +571,24 @@ _plugrack_read_single_dir( plugrack_t rack, char *dir ) ...@@ -566,6 +571,24 @@ _plugrack_read_single_dir( plugrack_t rack, char *dir )
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
/* Return TRUE if the specified pathname is recognized as that of a shared
* object (i.e. containing ".so") */
static bool
_so_file ( char *file_name )
{
int i;
if (file_name == NULL)
return false;
for (i=0; file_name[i] ;i++) {
if ( (file_name[i] == '.') && (file_name[i+1] == 's') &&
(file_name[i+2] == 'o') )
return true;
}
return false;
}
int int
plugrack_read_cache( plugrack_t rack, plugrack_read_cache( plugrack_t rack,
const char *cache_file ) const char *cache_file )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment