if (r < 0) {
if (r == -ENOENT)
return 0;
+ if (r == -EISDIR)
+ return r;
log_error("Failed to load %s: %s", path, strerror(-r));
return r;
}
}
-int policy_load(Policy *p) {
- _cleanup_strv_free_ char **l = NULL;
+int policy_load(Policy *p, char **files) {
char **i;
int r;
assert(p);
- file_load(p, "/etc/dbus-1/system.conf");
- file_load(p, "/etc/dbus-1/system-local.conf");
+ STRV_FOREACH(i, files) {
- r = conf_files_list(&l, ".conf", NULL, "/etc/dbus-1/system.d/", NULL);
- if (r < 0) {
- log_error("Failed to get configuration file list: %s", strerror(-r));
- return r;
- }
+ r = file_load(p, *i);
+ if (r == -EISDIR) {
+ _cleanup_strv_free_ char **l = NULL;
+ char **j;
+
+ r = conf_files_list(&l, ".conf", NULL, *i, NULL);
+ if (r < 0) {
+ log_error("Failed to get configuration file list: %s", strerror(-r));
+ return r;
+ }
+
+ STRV_FOREACH(j, l)
+ file_load(p, *j);
+ }
- STRV_FOREACH(i, l)
- file_load(p, *i);
+ /* We ignore all errors but EISDIR, and just proceed. */
+ }
return 0;
}
noreturn void policy_dump(Policy *p) {
- printf("→ Default Items:\n");
+ printf("%s Default Items:\n", draw_special_char(DRAW_ARROW));
dump_items(p->default_items);
- printf("→ Mandatory Items:\n");
+ printf("%s Mandatory Items:\n", draw_special_char(DRAW_ARROW));
dump_items(p->mandatory_items);
- printf("→ Group Items:\n");
+ printf("%s Group Items:\n", draw_special_char(DRAW_ARROW));
dump_hashmap_items(p->group_items);
- printf("→ User Items:\n");
+ printf("%s User Items:\n", draw_special_char(DRAW_ARROW));
dump_hashmap_items(p->user_items);
exit(0);
}