summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2012-10-16 11:01:29 +0200
committerLennart Poettering <lennart@poettering.net>2012-10-16 16:07:37 +0200
commit696c245a23d55e4249651573eb9c61b68e61580c (patch)
treee15b6d190757cd624f45354ae007640698c3b566
parentc3f60ec54da2a5d1ba00cec6bb2c282f079aa3f6 (diff)
systemctl: append .service when unit does not have valid suffix
systemctl status a and systemctl status a.service lead to same output but systemctl status a.b and systemctl status a.b.service do not.
-rw-r--r--src/shared/unit-name.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c
index cfe3133b5a..50031e608e 100644
--- a/src/shared/unit-name.c
+++ b/src/shared/unit-name.c
@@ -470,7 +470,6 @@ char *unit_dbus_path_from_name(const char *name) {
char *unit_name_mangle(const char *name) {
char *r, *t;
const char *f;
- bool dot = false;
assert(name);
@@ -491,10 +490,6 @@ char *unit_name_mangle(const char *name) {
return NULL;
for (f = name, t = r; *f; f++) {
-
- if (*f == '.')
- dot = true;
-
if (*f == '/')
*(t++) = '-';
else if (!strchr("@" VALID_CHARS, *f))
@@ -503,7 +498,7 @@ char *unit_name_mangle(const char *name) {
*(t++) = *f;
}
- if (!dot)
+ if (unit_name_to_type(name) < 0)
strcpy(t, ".service");
else
*t = 0;