chiark / gitweb /
core: don't change removed devices to state "tentative"
[elogind.git] / src / core / device.c
index e41ed4149fcb8f33eb1fb881f33a487240309097..b5d9d827e2ea11d9c792d4fa98d2cced95a9dd78 100644 (file)
@@ -140,7 +140,7 @@ static void device_set_state(Device *d, DeviceState state) {
         unit_notify(UNIT(d), state_translation_table[old_state], state_translation_table[state], true);
 }
 
-static int device_coldplug(Unit *u) {
+static int device_coldplug(Unit *u, Hashmap *deferred_work) {
         Device *d = DEVICE(u);
 
         assert(d);
@@ -209,6 +209,8 @@ static int device_update_description(Unit *u, struct udev_device *dev, const cha
                         j = strjoin(model, " ", label, NULL);
                         if (j)
                                 r = unit_set_description(u, j);
+                        else
+                                r = -ENOMEM;
                 } else
                         r = unit_set_description(u, model);
         } else
@@ -417,7 +419,7 @@ static void device_update_found_one(Device *d, bool add, DeviceFound found, bool
         if (now) {
                 if (d->found & DEVICE_FOUND_UDEV)
                         device_set_state(d, DEVICE_PLUGGED);
-                else if (d->found != DEVICE_NOT_FOUND)
+                else if (add && d->found != DEVICE_NOT_FOUND)
                         device_set_state(d, DEVICE_TENTATIVE);
                 else
                         device_set_state(d, DEVICE_DEAD);
@@ -566,7 +568,7 @@ static int device_enumerate(Manager *m) {
                 /* This will fail if we are unprivileged, but that
                  * should not matter much, as user instances won't run
                  * during boot. */
-                udev_monitor_set_receive_buffer_size(m->udev_monitor, 128*1024*1024);
+                (void) udev_monitor_set_receive_buffer_size(m->udev_monitor, 128*1024*1024);
 
                 r = udev_monitor_filter_add_match_tag(m->udev_monitor, "systemd");
                 if (r < 0)