[libvirt] [PATCH 1/3] rpc: socket: Add possibility to suppress errors on read hangup

Peter Krempa pkrempa at redhat.com
Fri Mar 17 16:16:08 UTC 2017


On Fri, Mar 17, 2017 at 16:10:35 +0000, Daniel Berrange wrote:
> 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(-)

[...]

> > +        } 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.

That is fine by me. The callers that will ignore the error don't really
care why the read failed currently.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170317/6d992e3e/attachment-0001.sig>


More information about the libvir-list mailing list