[systemd-devel] [PATCH 1/3] ignore ENOENT from can_install in listing unit files

Lennart Poettering lennart at poettering.net
Mon Jul 2 17:24:57 PDT 2012


On Sun, 01.07.12 19:37, Dave Reisner (dreisner at archlinux.org) wrote:

> A broken .include link in a unit file will cause 'systemctl
> list-unit-files' to simply return 'No such file or directory'. Ignore
> this silly error, since we know that the file really does exist.

Hmm, I figure we should at least log a message to syslog if this
happens, even if we don't return the error?

> ---
>  src/shared/install.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/shared/install.c b/src/shared/install.c
> index 13ae9a9..4bb91e2 100644
> --- a/src/shared/install.c
> +++ b/src/shared/install.c
> @@ -1949,7 +1949,7 @@ int unit_file_get_list(
>                                  goto found;
>  
>                          r = unit_file_can_install(&paths, root_dir, f->path, true);
> -                        if (r < 0) {
> +                        if (r < 0 && r != -ENOENT) {
>                                  free(f->path);
>                                  free(f);
>                                  goto finish;


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list