[systemd-commits] src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Tue Oct 16 07:11:28 PDT 2012


 src/shared/unit-name.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

New commits:
commit 696c245a23d55e4249651573eb9c61b68e61580c
Author: Lukas Nykryn <lnykryn at redhat.com>
Date:   Tue Oct 16 11:01:29 2012 +0200

    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.

diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c
index cfe3133..50031e6 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;



More information about the systemd-commits mailing list