summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-06-22 13:08:48 +0200
committerLennart Poettering <lennart@poettering.net>2012-06-22 13:08:48 +0200
commitb0193f1c1f1540bfccbdca02df82669b9308e4e2 (patch)
treec23e22e1857d73f7faff35ab1569a2070bac1797 /src/core
parent03658d4fd66d5d0ccce643cef92185ec38b0e575 (diff)
systemctl: automatically turn paths and unescaped unit names into proper unit names
This makes sure that systemctl status /home is implicitly translated to: systemctl status /home.mount Similar, /dev/foobar becomes dev-foobar.device. Also, all characters that cannot be part of a unit name are implicitly escaped.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/device.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/device.c b/src/core/device.c
index cd0a099546..f4c59b3a51 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -144,7 +144,8 @@ static int device_add_escaped_name(Unit *u, const char *dn) {
assert(dn);
assert(dn[0] == '/');
- if (!(e = unit_name_from_path(dn, ".device")))
+ e = unit_name_from_path(dn, ".device");
+ if (!e)
return -ENOMEM;
r = unit_add_name(u, e);
@@ -165,7 +166,8 @@ static int device_find_escape_name(Manager *m, const char *dn, Unit **_u) {
assert(dn[0] == '/');
assert(_u);
- if (!(e = unit_name_from_path(dn, ".device")))
+ e = unit_name_from_path(dn, ".device");
+ if (!e)
return -ENOMEM;
u = manager_get_unit(m, e);