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

Lennart Poettering lennart at poettering.net
Tue Oct 16 07:11:36 PDT 2012


On Tue, 16.10.12 11:01, Lukas Nykryn (lnykryn at redhat.com) wrote:

> 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.

Thanks! Appplied!

> ---
>  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;


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list