All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] qio_dns_resolver_lookup_sync() and SOCKET_ADDRESS_KIND_FD?
Date: Thu, 23 Mar 2017 17:30:07 +0100	[thread overview]
Message-ID: <87var0c5ww.fsf@dusky.pond.sub.org> (raw)

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;
    }
}

             reply	other threads:[~2017-03-23 16:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 16:30 Markus Armbruster [this message]
2017-04-03 11:29 ` [Qemu-devel] qio_dns_resolver_lookup_sync() and SOCKET_ADDRESS_KIND_FD? Daniel P. Berrange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87var0c5ww.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.