io: Use qio_channel_has_feature() where applicable

Parts of the code have been testing QIOChannel features directly with a
logical AND. This patch makes it all consistent by using the
qio_channel_has_feature() function to test if a feature is present.

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Felipe Franciosi 2016-09-29 08:52:36 -07:00 committed by Daniel P. Berrange
parent 8fbf661212
commit e413ae0c04
4 changed files with 6 additions and 5 deletions

View file

@ -403,7 +403,8 @@ static void qio_channel_socket_finalize(Object *obj)
QIOChannelSocket *ioc = QIO_CHANNEL_SOCKET(obj);
if (ioc->fd != -1) {
if (QIO_CHANNEL(ioc)->features & (1 << QIO_CHANNEL_FEATURE_LISTEN)) {
QIOChannel *ioc_local = QIO_CHANNEL(ioc);
if (qio_channel_has_feature(ioc_local, QIO_CHANNEL_FEATURE_LISTEN)) {
Error *err = NULL;
socket_listen_cleanup(ioc->fd, &err);