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

Dave Reisner d at falconindy.com
Mon Jul 2 18:00:28 PDT 2012


On Tue, Jul 03, 2012 at 02:24:57AM +0200, Lennart Poettering wrote:
> 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?
> 

I agree! However, this is best just be ignored for now. I wrote this
back in April and can't seem to reproduce the bug as per the commit
message. I'll resurface it with journaltastic logging if it comes up
again.

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