On Thu, May 31, 2018 at 09:45:59AM +0200, Sergio Lopez wrote: > QIO_CHANNEL_ERR_BROKEN is used to identify a potentially unrecoverable > error in the channel, like EPIPE. > --- > include/io/channel.h | 1 + > io/channel-file.c | 3 +++ > 2 files changed, 4 insertions(+) > > diff --git a/include/io/channel.h b/include/io/channel.h > index e8cdadb..bbe45f6 100644 > --- a/include/io/channel.h > +++ b/include/io/channel.h > @@ -38,6 +38,7 @@ typedef struct QIOChannel QIOChannel; > typedef struct QIOChannelClass QIOChannelClass; > > #define QIO_CHANNEL_ERR_BLOCK -2 > +#define QIO_CHANNEL_ERR_BROKEN -3 > > typedef enum QIOChannelFeature QIOChannelFeature; > > diff --git a/io/channel-file.c b/io/channel-file.c > index db948ab..a990f67 100644 > --- a/io/channel-file.c > +++ b/io/channel-file.c > @@ -124,6 +124,9 @@ static ssize_t qio_channel_file_writev(QIOChannel *ioc, > if (errno == EAGAIN) { > return QIO_CHANNEL_ERR_BLOCK; > } > + if (errno == EPIPE) { > + return QIO_CHANNEL_ERR_BROKEN; > + } > if (errno == EINTR) { > goto retry; > }
I don't see a compelling reason to add this. EAGAIN needs special handling because we do not wish to set the "Error **errp" object. EPIPE can be just handled by callers in the same way as any other errno value, by closing the connection. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|