chiark / gitweb /
dbus: be a bit more explicit about which bus connection failed
[elogind.git] / device.c
index 1b0b50fd4e796752826d79a278c4d322c7430919..32995fd159acbd82b936889a839b5d5e5032e22e 100644 (file)
--- a/device.c
+++ b/device.c
@@ -186,8 +186,10 @@ static int device_process_new_device(Manager *m, struct udev_device *dev, bool u
 
         if (names) {
                 FOREACH_WORD(w, l, names, state) {
-                        if (!(e = strndup(w, l)))
+                        if (!(e = strndup(w, l))) {
+                                r = -ENOMEM;
                                 goto fail;
+                        }
 
                         r = unit_add_name(u, e);
                         free(e);
@@ -199,8 +201,10 @@ static int device_process_new_device(Manager *m, struct udev_device *dev, bool u
 
         if (wants) {
                 FOREACH_WORD(w, l, wants, state) {
-                        if (!(e = strndup(w, l)))
+                        if (!(e = strndup(w, l))) {
+                                r = -ENOMEM;
                                 goto fail;
+                        }
 
                         r = unit_add_dependency_by_name(u, UNIT_WANTS, e);
                         free(e);
@@ -377,7 +381,7 @@ fail:
 const UnitVTable device_vtable = {
         .suffix = ".device",
 
-        .init = unit_load_fragment_and_dropin,
+        .init = unit_load_fragment_and_dropin_optional,
         .done = device_done,
         .coldplug = device_coldplug,