[systemd-devel] [PATCH] systemctl: append .service when unit does not have valid suffix

Lukas Nykryn lnykryn at redhat.com
Tue Oct 16 02:01:29 PDT 2012


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.
---
 src/shared/unit-name.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c
index cfe3133..b0539c7 100644
--- a/src/shared/unit-name.c
+++ b/src/shared/unit-name.c
@@ -491,10 +491,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 +499,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;
-- 
1.7.6.5



More information about the systemd-devel mailing list