[systemd-devel] [PATCH] systemctl: don't mangle name when it is a path

Lennart Poettering lennart at poettering.net
Mon Oct 15 07:36:22 PDT 2012


On Mon, 15.10.12 14:51, Lukas Nykryn (lnykryn at redhat.com) wrote:

Hi!

> systemctl enable, disable, ... can also accept full path and in this case
> we don't need to alter it (rhbz#866346).

Hmm, so I can't say I really like the asymmetry between "systemctl
enable" and "systemctl status" now, but then again I had no better idea
than this, hence I commited your fix (but added a comment, explaining
why we do this).

Thanks!

> ---
>  src/systemctl/systemctl.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
> index d1fbb78..4576bbf 100644
> --- a/src/systemctl/systemctl.c
> +++ b/src/systemctl/systemctl.c
> @@ -3594,7 +3594,10 @@ static int mangle_names(char **original_names, char ***mangled_names) {
>  
>          i = l;
>          STRV_FOREACH(name, original_names) {
> -                *i = unit_name_mangle(*name);
> +                if(is_path(*name))
> +                        *i = strdup(*name);
> +                else
> +                        *i = unit_name_mangle(*name);
>                  if (!*i) {
>                          strv_free(l);
>                          return log_oom();


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list