On Fri, Mar 17, 2017 at 04:48:49PM +0100, Peter Krempa wrote: > In some cases a read error due to connection hangup is expected. This > patch adds a flag that removes the logging of a virError in such case. > --- > src/rpc/virnetsocket.c | 33 +++++++++++++++++++++++++++------ > src/rpc/virnetsocket.h | 2 ++ > 2 files changed, 29 insertions(+), 6 deletions(-) > > diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c > index 325a7c7cf..4d1dc6446 100644 > --- a/src/rpc/virnetsocket.c > +++ b/src/rpc/virnetsocket.c > @@ -82,6 +82,7 @@ struct _virNetSocket { > int errfd; > bool client; > bool ownsFd; > + bool quietEOF; > > /* Event callback fields */ > virNetSocketIOFunc func; > @@ -1792,12 +1793,18 @@ static ssize_t virNetSocketReadWire(virNetSocketPtr sock, char *buf, size_t len) > _("Cannot recv data")); > ret = -1; > } else if (ret == 0) { > - if (errout) > - virReportSystemError(EIO, > - _("End of file while reading data: %s"), errout); > - else > - virReportSystemError(EIO, "%s", > - _("End of file while reading data")); > + if (sock->quietEOF) { > + VIR_DEBUG("socket='%p' EOF while reading: errout='%s'", > + socket, NULLSTR(errout)); > + } else { > + if (errout) > + virReportSystemError(EIO, > + _("End of file while reading data: %s"), > + errout); > + else > + virReportSystemError(EIO, "%s", > + _("End of file while reading data")); > + } > ret = -1; I'm a little uncomfortable with the idea of returning '-1' without reporting an error message. I would suggest returning 0, but we used that to indicate EAGAIN condition. Can we at least make it return '-2' as a distinct code when we don't report errors. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list