summaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c
index bffeca0d10..64665a8b87 100644
--- a/src/device.c
+++ b/src/device.c
@@ -198,10 +198,12 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
if (!u) {
delete = true;
- if (!(u = unit_new(m)))
+ u = unit_new(m, sizeof(Device));
+ if (!u)
return -ENOMEM;
- if ((r = device_add_escaped_name(u, path)) < 0)
+ r = device_add_escaped_name(u, path);
+ if (r < 0)
goto fail;
unit_add_to_load_queue(u);
@@ -583,6 +585,7 @@ DEFINE_STRING_TABLE_LOOKUP(device_state, DeviceState);
const UnitVTable device_vtable = {
.suffix = ".device",
+ .object_size = sizeof(Device),
.sections =
"Unit\0"
"Device\0"