[systemd-devel] [PATCH] journalctl: quit on I/O error
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Tue Jan 15 12:02:04 PST 2013
On Tue, Jan 15, 2013 at 08:59:28PM +0100, Lennart Poettering wrote:
> On Sun, 13.01.13 12:28, David Herrmann (dh.herrmann at googlemail.com) wrote:
>
> > This makes journalctl quit on ferror() conditions on stdout. It fixes an
> > annoying bug if you pipe its output through 'less' and press 'q'. Without
> > this fix journalctl will continue reading all journal data until EOF which
> > can take quite some time. For instance on my machine:
>
> Applied! Thanks!
> > +++ b/src/journal/journalctl.c
> > @@ -1077,7 +1077,7 @@ int main(int argc, char *argv[]) {
> > arg_catalog * OUTPUT_CATALOG;
> >
> > r = output_journal(stdout, j, arg_output, 0, flags);
> > - if (r < 0)
> > + if (r < 0 || ferror(stdout))
> > goto finish;
> >
> > need_seek = true;
Hm, is this the proper place to check for errors? Shouldn't the journal
output functions check for errors instead?
Zbyszek
More information about the systemd-devel
mailing list