summaryrefslogtreecommitdiff
path: root/src/core/device.c
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-04-12 11:56:27 +0200
committerHarald Hoyer <harald@redhat.com>2013-04-17 09:05:37 +0200
commit003ac9d0318ce28e0b29af5440c9f28f884da04c (patch)
treebd733474815838d0c3b677a7037cd5243e43e1ea /src/core/device.c
parentaa21e2bf2112f185649c534ab15086ca4498a194 (diff)
core/device.c: fix possible segfault
https://bugs.freedesktop.org/show_bug.cgi?id=63189 better fail than segfault systemd[1]: Failed to load device unit: Invalid argument systemd[1]: Failed to process udev device event: Invalid argument
Diffstat (limited to 'src/core/device.c')
-rw-r--r--src/core/device.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/device.c b/src/core/device.c
index fb948688b6..734d3f32e1 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -312,6 +312,7 @@ fail:
static int device_process_new_device(Manager *m, struct udev_device *dev, bool update_state) {
const char *sysfs, *dn;
struct udev_list_entry *item = NULL, *first = NULL;
+ int r;
assert(m);
@@ -319,7 +320,9 @@ static int device_process_new_device(Manager *m, struct udev_device *dev, bool u
return -ENOMEM;
/* Add the main unit named after the sysfs path */
- device_update_unit(m, dev, sysfs, true);
+ r = device_update_unit(m, dev, sysfs, true);
+ if (r < 0)
+ return r;
/* Add an additional unit for the device node */
if ((dn = udev_device_get_devnode(dev)))