- snprintf(filename, sizeof(filename), "%s/%s", udev_db_path, ent->d_name);
- filename[sizeof(filename)-1] = '\0';
- dbg("looking at '%s'", filename);
-
- if (file_map(filename, &buf, &bufsize) != 0) {
- err("unable to read db file '%s'", filename);
- continue;
- }
-
- path[0] = '\0';
- nodename[0] = '\0';
- cur = 0;
- while (cur < bufsize) {
- count = buf_get_line(buf, bufsize, cur);
- bufline = &buf[cur];
- cur += count+1;
-
- switch(bufline[0]) {
- case 'P':
- if (count > sizeof(path))
- count = sizeof(path);
- memcpy(path, &bufline[2], count-2);
- path[count-2] = '\0';
- break;
- case 'N':
- if (count > sizeof(nodename))
- count = sizeof(nodename);
- memcpy(nodename, &bufline[2], count-2);
- nodename[count-2] = '\0';
- break;
- default:
- continue;
- }
- }
- file_unmap(buf, bufsize);
-
- if (path[0] == '\0' || nodename[0] == '\0')
- continue;
-
- if (handler_function(path, nodename) != 0)
- break;
+ end = strlcat(filename, ent->d_name, sizeof(filename));
+ for (i = 1; i < end; i++)
+ if (filename[i] == PATH_TO_NAME_CHAR)
+ filename[i] = '/';
+ name_list_add(name_list, filename, 1);
+ dbg("added '%s'", filename);