diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-01-08 17:41:41 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-01-08 22:15:27 -0500 |
commit | 2ad8416dd057e7e3185169609ca3006e7649f576 (patch) | |
tree | 5dee188dd83213dca612e4509e5ec333290557c1 /src/udev/udev-rules.c | |
parent | d8160f21fd295b451cee9679aa281fedf1cb8e8c (diff) |
No need to canonicalize fixed paths
Diffstat (limited to 'src/udev/udev-rules.c')
-rw-r--r-- | src/udev/udev-rules.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 52634f137d..8d2b057e2f 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -46,9 +46,14 @@ struct uid_gid { }; }; +static const char* const rules_dirs[] = { + "/etc/udev/rules.d", + "/run/udev/rules.d", + UDEVLIBEXECDIR "/rules.d", + NULL}; + struct udev_rules { struct udev *udev; - char **dirs; usec_t dirs_ts_usec; int resolve_names; @@ -1629,23 +1634,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (!rules->strbuf) return udev_rules_unref(rules); - rules->dirs = strv_new("/etc/udev/rules.d", - "/run/udev/rules.d", - UDEVLIBEXECDIR "/rules.d", - NULL); - if (!rules->dirs) { - log_error("failed to build config directory array"); - return udev_rules_unref(rules); - } - if (!path_strv_canonicalize(rules->dirs)) { - log_error("failed to canonicalize config directories"); - return udev_rules_unref(rules); - } - strv_uniq(rules->dirs); - udev_rules_check_timestamp(rules); - r = conf_files_list_strv(&files, ".rules", NULL, (const char **)rules->dirs); + r = conf_files_list_strv(&files, ".rules", NULL, rules_dirs); if (r < 0) { log_error("failed to enumerate rules files: %s", strerror(-r)); return udev_rules_unref(rules); @@ -1697,7 +1688,6 @@ struct udev_rules *udev_rules_unref(struct udev_rules *rules) strbuf_cleanup(rules->strbuf); free(rules->uids); free(rules->gids); - strv_free(rules->dirs); free(rules); return NULL; } @@ -1707,7 +1697,7 @@ bool udev_rules_check_timestamp(struct udev_rules *rules) if (!rules) return false; - return paths_check_timestamp(rules->dirs, &rules->dirs_ts_usec, true); + return paths_check_timestamp(rules_dirs, &rules->dirs_ts_usec, true); } static int match_key(struct udev_rules *rules, struct token *token, const char *val) |