udev: fix path for database names on 'change' event
authorRobert Milasan <rmilasan@suse.com>
Sat, 13 Sep 2014 13:18:37 +0000 (15:18 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Thu, 18 Sep 2014 13:28:07 +0000 (15:28 +0200)
If a device does not have a major/minor number attached, we use different
database names than if it does. On "change" events, we didn't copy the
devnum over, therefore, we used different paths than on 'add' or 'remove'
events (where devnum was properly copied).

Fix this by always copying the devnum into the udev-device.

(David: added commit-log from email)

src/libudev/libudev-device.c
src/libudev/libudev-private.h
src/udev/udev-event.c

index d61a2ad8f46bbbf100be39f41bcd9d90f338c786..26993740728268fbf3e02d09685f87315d563f50 100644 (file)
@@ -161,7 +161,7 @@ _public_ dev_t udev_device_get_devnum(struct udev_device *udev_device)
         return udev_device->devnum;
 }
 
-static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
+int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
 {
         char num[32];
 
index 2f74bc0883e0261949091c277cb45664068f076d..7e11f7326d708c9f9e8bd092b662f8cc0ebd4d31 100644 (file)
@@ -59,6 +59,7 @@ uid_t udev_device_get_devnode_uid(struct udev_device *udev_device);
 gid_t udev_device_get_devnode_gid(struct udev_device *udev_device);
 int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem);
 int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
+int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum);
 int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink);
 void udev_device_cleanup_devlinks_list(struct udev_device *udev_device);
 struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value);
index dc1f682bfe56afedcc254a2ab6657a09a23f2800..30a670890174c3d292661f1226821a02703572c5 100644 (file)
@@ -813,6 +813,7 @@ void udev_event_execute_rules(struct udev_event *event,
                 if (event->dev_db != NULL) {
                         udev_device_set_syspath(event->dev_db, udev_device_get_syspath(dev));
                         udev_device_set_subsystem(event->dev_db, udev_device_get_subsystem(dev));
+                        udev_device_set_devnum(event->dev_db, udev_device_get_devnum(dev));
                         udev_device_read_db(event->dev_db, NULL);
                         udev_device_set_info_loaded(event->dev_db);