Anonymous avatar Anonymous committed b0a0080

use devnode() for $name not sysname(), device nodes might be in a subdirectory

Comments (0)

Files changed (1)

                         if (udev_device_get_devnode(dev) != NULL)
                                 l = util_strpcpy(&s, l, udev_device_get_devnode(dev));
-                case SUBST_NAME:
+                case SUBST_NAME: {
+                        size_t devlen = strlen(udev_get_dev_path(event->udev))+1;
                         if (event->name != NULL) {
                                 l = util_strpcpy(&s, l, event->name);
-                                dbg(event->udev, "substitute name '%s'\n", event->name);
+                                dbg(event->udev, "substitute custom name '%s'\n", event->name);
                         } else {
-                                l = util_strpcpy(&s, l, udev_device_get_sysname(dev));
-                                dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev));
+                                l = util_strpcpy(&s, l, &udev_device_get_devnode(dev)[devlen]);
+                                dbg(event->udev, "substitute name'%s'\n", &udev_device_get_devnode(dev)[devlen]);
+                }
                 case SUBST_LINKS: {
                         size_t devlen = strlen(udev_get_dev_path(event->udev))+1;
                         struct udev_list_entry *list_entry;
-                if (major(udev_device_get_devnum(dev)) != 0) {
+                if (major(udev_device_get_devnum(dev)) > 0) {
                         /* remove/update possible left-over symlinks from old database entry */
                         if (event->dev_db != NULL)
                                 udev_node_update_old_links(dev, event->dev_db);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.