[systemd-devel] [PATCH] log_error(), if inotify_add_watch() fails

Lennart Poettering lennart at poettering.net
Wed Feb 13 07:27:59 PST 2013


On Wed, 13.02.13 16:16, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:

> 
> On Wed, Feb 13, 2013 at 03:09:36PM +0100, harald at redhat.com wrote:
> >                  k = inotify_add_watch(fd, "/run/systemd/seats/", IN_MOVED_TO|IN_DELETE);
> >                  if (k < 0) {
> > +                        log_error("Failed to watch /run/systemd/seats/: %m");
> >                          close_nointr_nofail(fd);
> Applied. I changed /Failed to watch/ to /Failed to add watch on/. I think it
> makes the message slightly clearer.

Sorry, I had to revert this commit. We should never log anything from
library calls. This would be as if open() or write() of the glibc would
log something to stderr as side-effect.

Logging is only only OK in "main programs" but never from library code,
and this code in particular is compiled into an .so for normal
consumers, so it should not log, but always only return error codes.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list