[systemd-devel] [systemd-commits] src/shared

Lennart Poettering lennart at poettering.net
Mon Aug 25 19:06:13 PDT 2014


On Mon, 25.08.14 07:06, Lukas Nykryn (lnykryn at kemper.freedesktop.org) wrote:

>  src/shared/install.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> New commits:
> commit 41a451cc2901a5deb985aea4cc8de204a22e5612
> Author: Lukas Nykryn <lnykryn at redhat.com>
> Date:   Mon Aug 25 15:29:50 2014 +0200
> 
>     systemctl: fix broken list-unit-files with --root
>     
>     This patch modifies unit_file_get_list which will now return
>     hashmap of structures where f->path is *without* root_dir prefix.
>     
>     This change should be ok, because current code either does not use
>     root_dir at all or calls basename() on the f->path.
> 
> diff --git a/src/shared/install.c b/src/shared/install.c
> index 4b09a69..a07d1dd 100644
> --- a/src/shared/install.c
> +++ b/src/shared/install.c
> @@ -2099,7 +2099,7 @@ int unit_file_get_list(
>                          if (!f)
>                                  return -ENOMEM;
>  
> -                        f->path = path_make_absolute(de->d_name, units_dir);
> +                        f->path = path_make_absolute(de->d_name, *i);
>                          if (!f->path)
>                                  return -ENOMEM;

This looks wrong. We actually do make use of f->path immediately after
generating this path, by passing it to null_or_empty_path(). With your
change this would not work correctly anymore...

The fix for the problem you found must look differently I
guess. Reverted for now.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list