- // Check if a metadata file exists in the current directory
- metafd = openat(dirfd, "metadata", O_RDONLY);
- if (metafd < 0) {
- ret = close(dirfd);
- if (ret < 0) {
- g_warning("Unable to open metadata "
- "file descriptor : %s.", node->fts_accpath);
- goto error;
- }
- } else {
- ret = close(metafd);
- if (ret < 0) {
- g_warning("Unable to close metadata "
- "file descriptor : %s.", node->fts_accpath);
- goto error;
- }
- ret = close(dirfd);
- if (ret < 0) {
- g_warning("Unable to close trace "
- "directory file descriptor : %s.", node->fts_accpath);
- goto error;
- }
-
- ret = lttv_traceset_create_trace(ts, node->fts_accpath);
- if (ret < 0) {
- g_warning("Opening trace \"%s\" from %s "
- "for reading.", node->fts_accpath, trace_path);
- goto error;
+ struct dirent curentry;
+ struct dirent *resultentry;
+ while ((ret = readdir_r(curdir, &curentry, &resultentry)) == 0) {
+ if (resultentry == NULL) {
+ /* No more entry*/
+ break;
+ }
+ if (curentry.d_name[0] != '.') {
+ if (curentry.d_type == DT_DIR) {
+
+ char curpath[PATH_MAX];
+ snprintf(curpath, PATH_MAX, "%s/%s", trace_path, curentry.d_name);
+ ret = lttv_traceset_add_path(ts, curpath);
+ if (ret >= 0) {
+ metaFileFound = TRUE;
+ }