chiark / gitweb /
udevd: fix REMOVE handling
authorTom Gundersen <teg@jklm.no>
Thu, 23 Apr 2015 13:19:13 +0000 (15:19 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 07:11:52 +0000 (08:11 +0100)
This reverts b67f944. Lazy loading of device properties does not work for devices
that are received over netlink, as these are sealed. Reinstate the unconditional
loading of the device db.

Reported by: Mantas Mikulėnas <grawity@gmail.com>.

src/libelogind/sd-device/device-internal.h
src/libelogind/sd-device/device-private.c
src/libelogind/sd-device/device-private.h
src/libelogind/sd-device/sd-device.c

index 59ec1a6d73eb6f05c4ce9165582da7ff1bfd46a8..b96441de56960a0ec4d80027b1d6ec288a6973c6 100644 (file)
@@ -110,6 +110,7 @@ int device_new_aux(sd_device **ret);
 int device_add_property_aux(sd_device *device, const char *key, const char *value, bool db);
 int device_add_property_internal(sd_device *device, const char *key, const char *value);
 int device_read_uevent_file(sd_device *device);
+int device_read_db_aux(sd_device *device, bool force);
 
 int device_set_syspath(sd_device *device, const char *_syspath, bool verify);
 int device_set_ifindex(sd_device *device, const char *ifindex);
index 9788df769cfbf249e730da89838a26092974523b..3cadedbf4a6e513ee106b7988e865c2ff23489ae 100644 (file)
@@ -1100,3 +1100,9 @@ int device_delete_db(sd_device *device) {
 
         return 0;
 }
+
+int device_read_db_force(sd_device *device) {
+        assert(device);
+
+        return device_read_db_aux(device, true);
+}
index f25248150ec30e6497eaef2fc7ddc6cc11237137..49a7b66a2b1a02e96b3b6e5e69c34330322b2aab 100644 (file)
@@ -61,3 +61,4 @@ int device_new_from_synthetic_event(sd_device **new_device, const char *syspath,
 int device_tag_index(sd_device *dev, sd_device *dev_old, bool add);
 int device_update_db(sd_device *device);
 int device_delete_db(sd_device *device);
+int device_read_db_force(sd_device *device);
index 7a7b323f3ce61ab4d57668cb454f55a724f504a7..fd4622987c04f91c15401156b0eadb55e95ab854 100644 (file)
@@ -1220,7 +1220,7 @@ int device_get_id_filename(sd_device *device, const char **ret) {
         return 0;
 }
 
-static int device_read_db(sd_device *device) {
+int device_read_db_aux(sd_device *device, bool force) {
         _cleanup_free_ char *db = NULL;
         char *path;
         const char *id, *value;
@@ -1237,7 +1237,7 @@ static int device_read_db(sd_device *device) {
                 INVALID_LINE,
         } state = PRE_KEY;
 
-        if (device->db_loaded || device->sealed)
+        if (device->db_loaded || (!force && device->sealed))
                 return 0;
 
         r = device_get_id_filename(device, &id);
@@ -1313,6 +1313,10 @@ static int device_read_db(sd_device *device) {
         return 0;
 }
 
+static int device_read_db(sd_device *device) {
+        return device_read_db_aux(device, false);
+}
+
 _public_ int sd_device_get_is_initialized(sd_device *device, int *initialized) {
         int r;