All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] qio_dns_resolver_lookup_sync() and SOCKET_ADDRESS_KIND_FD?
@ 2017-03-23 16:30 Markus Armbruster
  2017-04-03 11:29 ` Daniel P. Berrange
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Armbruster @ 2017-03-23 16:30 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel

Ignorant question: does qio_dns_resolver_lookup_sync() do the right
thing for SOCKET_ADDRESS_KIND_FD?  The switch doesn't have a case for
it, and it's unclear whether the default case is really meant for
SOCKET_ADDRESS_KIND_FD in addition to impossible enumeration values.

Aside: impossible value means your program state is fatally
compromised.  I'd rather assert then.


int qio_dns_resolver_lookup_sync(QIODNSResolver *resolver,
                                 SocketAddress *addr,
                                 size_t *naddrs,
                                 SocketAddress ***addrs,
                                 Error **errp)
{
    switch (addr->type) {
    case SOCKET_ADDRESS_KIND_INET:
        return qio_dns_resolver_lookup_sync_inet(resolver,
                                                 addr,
                                                 naddrs,
                                                 addrs,
                                                 errp);

    case SOCKET_ADDRESS_KIND_UNIX:
    case SOCKET_ADDRESS_KIND_VSOCK:
        return qio_dns_resolver_lookup_sync_nop(resolver,
                                                addr,
                                                naddrs,
                                                addrs,
                                                errp);

    default:
        error_setg(errp, "Unknown socket address kind");
        return -1;
    }
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-03 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-23 16:30 [Qemu-devel] qio_dns_resolver_lookup_sync() and SOCKET_ADDRESS_KIND_FD? Markus Armbruster
2017-04-03 11:29 ` Daniel P. Berrange

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.