projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Discover plugins in converter.c
[babeltrace.git]
/
plugins
/
component-factory.c
diff --git
a/plugins/component-factory.c
b/plugins/component-factory.c
index 03e0148595065ee1a14e4e2ce17673e9ed275ed9..28b1e10618a4bfd90372d7a1dde44210ec558f50 100644
(file)
--- a/
plugins/component-factory.c
+++ b/
plugins/component-factory.c
@@
-170,11
+170,25
@@
bt_component_factory_load_dir_recursive(struct bt_component_factory *factory,
file_path[path_len++] = '/';
}
file_path[path_len++] = '/';
}
+ directory = opendir(file_path);
+ if (!directory) {
+ perror("Failed to open plug-in directory");
+ ret = BT_COMPONENT_FACTORY_STATUS_ERROR;
+ goto end;
+ }
+
/* Recursively walk directory */
while (!readdir_r(directory, entry, &result) && result) {
struct stat st;
int stat_ret;
/* Recursively walk directory */
while (!readdir_r(directory, entry, &result) && result) {
struct stat st;
int stat_ret;
- size_t file_name_len = strlen(result->d_name);
+ size_t file_name_len;
+
+ if (result->d_name[0] == '.') {
+ /* Skip hidden files, . and .. */
+ continue;
+ }
+
+ file_name_len = strlen(result->d_name);
if (path_len + file_name_len >= PATH_MAX) {
continue;
if (path_len + file_name_len >= PATH_MAX) {
continue;
@@
-201,6
+215,15
@@
bt_component_factory_load_dir_recursive(struct bt_component_factory *factory,
}
}
end:
}
}
end:
+ if (directory) {
+ if (closedir(directory)) {
+ /*
+ * We don't want to override the error since there is
+ * nothing could do.
+ */
+ perror("Failed to close plug-in directory");
+ }
+ }
free(entry);
free(file_path);
return ret;
free(entry);
free(file_path);
return ret;
This page took
0.024623 seconds
and
4
git commands to generate.