diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2012-06-13 18:22:08 +0200 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2012-06-13 18:42:02 +0200 |
commit | 48899192a7b28b6a338cc8ec18aa35ccd8867acb (patch) | |
tree | a5fa3b09e7339b04c51c107549f65846cecf26cf /src/shared/unit-name.c | |
parent | 1c291cf34cb22c8ca5ec0db122bd5e8bfabe9ac5 (diff) |
unit-name: introduce unit_dbus_path_from_name()
Use the same function in core and in systemctl.
get_unit_path() in systemctl becomes unnecessary.
Diffstat (limited to 'src/shared/unit-name.c')
-rw-r--r-- | src/shared/unit-name.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c index 1440d2f2ea..91f464ee9c 100644 --- a/src/shared/unit-name.c +++ b/src/shared/unit-name.c @@ -458,3 +458,16 @@ char *unit_name_path_unescape(const char *f) { return e; } + +char *unit_dbus_path_from_name(const char *name) { + char *e, *p; + + e = bus_path_escape(name); + if (!e) + return NULL; + + p = strappend("/org/freedesktop/systemd1/unit/", e); + free(e); + + return p; +} |