diff options
-rw-r--r-- | src/core/device.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/device.c b/src/core/device.c index e83e797787..9fca82ab16 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -281,16 +281,22 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p size_t l; FOREACH_WORD_QUOTED(w, l, wants, state) { - char *e; + char *e, *n; e = strndup(w, l); if (!e) { r = -ENOMEM; goto fail; } - - r = unit_add_dependency_by_name(u, UNIT_WANTS, e, NULL, true); + n = unit_name_mangle(e); + if (!n) { + r = -ENOMEM; + goto fail; + } free(e); + + r = unit_add_dependency_by_name(u, UNIT_WANTS, n, NULL, true); + free(n); if (r < 0) goto fail; } |