chiark / gitweb /
087 release
[elogind.git] / udev_rules_parse.c
index b664b98..376006c 100644 (file)
 #include <sys/stat.h>
 #include <errno.h>
 
-#include "udev_libc_wrapper.h"
 #include "udev.h"
-#include "udev_utils.h"
-#include "logging.h"
 #include "udev_rules.h"
 
 
@@ -369,6 +366,16 @@ static int add_to_rules(struct udev_rules *rules, char *line)
                                pos = strchr(file, ' ');
                                if (pos)
                                        pos[0] = '\0';
+
+                               /* allow programs in /lib/udev called without the path */
+                               if (strchr(file, '/') == NULL) {
+                                       strlcpy(file, "/lib/udev/", sizeof(file));
+                                       strlcat(file, value, sizeof(file));
+                                       pos = strchr(file, ' ');
+                                       if (pos)
+                                               pos[0] = '\0';
+                               }
+
                                dbg("IMPORT auto mode for '%s'", file);
                                if (!lstat(file, &stats) && (stats.st_mode & S_IXUSR)) {
                                        dbg("IMPORT is executable, will be executed (autotype)");
@@ -617,7 +624,7 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names)
                                else
                                        dbg("empty rules file '%s'", name_loop->name);
                        } else
-                               dbg("could not read '%s'", name_loop->name);
+                               err("could not read '%s': %s", name_loop->name, strerror(errno));
                        list_del(&name_loop->node);
                        free(name_loop);
                }
@@ -626,7 +633,7 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names)
        return retval;
 }
 
-void udev_rules_close(struct udev_rules *rules)
+void udev_rules_cleanup(struct udev_rules *rules)
 {
        if (rules->buf) {
                free(rules->buf);