+ 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);
+ strlcpy(path, &bufline[2], count-1);
+ break;
+ case 'N':
+ if (count > sizeof(nodename))
+ count = sizeof(nodename);
+ strlcpy(nodename, &bufline[2], count-1);
+ break;
+ default:
+ continue;
+ }
+ }
+ file_unmap(buf, bufsize);
+
+ if (path[0] == '\0' || nodename[0] == '\0')
+ continue;
+
+ if (handler_function(path, nodename) != 0)
+ break;
+ }
+
+ closedir(dir);