summaryrefslogtreecommitdiff
path: root/udev_rules_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'udev_rules_parse.c')
-rw-r--r--udev_rules_parse.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index cededf002d..488b7a7ff0 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -607,7 +607,7 @@ static int rules_map(struct udev_rules *rules, const char *filename)
return 0;
}
-int udev_rules_init(struct udev_rules *rules, int resolve_names)
+int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_names)
{
char comp[PATH_SIZE];
struct stat stats;
@@ -617,14 +617,17 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names)
rules->resolve_names = resolve_names;
/* check for precompiled rules */
- strlcpy(comp, udev_rules_filename, sizeof(comp));
- strlcat(comp, ".compiled", sizeof(comp));
- if (stat(comp, &stats) == 0) {
- dbg("map compiled rules '%s'", comp);
- if (rules_map(rules, comp) == 0)
- return 0;
+ if (read_compiled) {
+ strlcpy(comp, udev_rules_filename, sizeof(comp));
+ strlcat(comp, ".compiled", sizeof(comp));
+ if (stat(comp, &stats) == 0) {
+ dbg("map compiled rules '%s'", comp);
+ if (rules_map(rules, comp) == 0)
+ return 0;
+ }
}
+ /* parse rules file or all matching files in directory */
if (stat(udev_rules_filename, &stats) != 0)
return -1;