eal: load only shared libs from driver plugin directories
When we pass a "-d" flag to EAL pointing to a directory, we attempt to load all files in that directory as driver plugins, irrespective of file type. This procludes using e.g. the build/drivers directory, as a driver source since it contains static libs and other files as well as the shared objects. By filtering out any files whose filename does not end in ".so", we can improve usability by allowing other non-driver files to be present in the driver directory. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
parent
efa75d61d2
commit
49b536fc30
@ -378,9 +378,15 @@ eal_plugindir_init(const char *path)
|
||||
|
||||
while ((dent = readdir(d)) != NULL) {
|
||||
struct stat sb;
|
||||
int nlen = strnlen(dent->d_name, sizeof(dent->d_name));
|
||||
|
||||
/* check if name ends in .so */
|
||||
if (strcmp(&dent->d_name[nlen - 3], ".so") != 0)
|
||||
continue;
|
||||
|
||||
snprintf(sopath, sizeof(sopath), "%s/%s", path, dent->d_name);
|
||||
|
||||
/* if a regular file, add to list to load */
|
||||
if (!(stat(sopath, &sb) == 0 && S_ISREG(sb.st_mode)))
|
||||
continue;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user