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.