提交 dc0d4efc 编写于 作者: L Luiz Capitulino 提交者: Anthony Liguori

vnc: Use inet_strfamily()

Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 c445321e
......@@ -100,26 +100,6 @@ char *vnc_socket_remote_addr(const char *format, int fd) {
return addr_to_string(format, &sa, salen);
}
static QString *get_sock_family(const struct sockaddr_storage *sa)
{
const char *name;
switch (sa->ss_family)
{
case AF_INET:
name = "ipv4";
break;
case AF_INET6:
name = "ipv6";
break;
default:
name = "unknown";
break;
}
return qstring_from_str(name);
}
static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
socklen_t salen)
{
......@@ -138,7 +118,7 @@ static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
qdict_put(qdict, "host", qstring_from_str(host));
qdict_put(qdict, "service", qstring_from_str(serv));
qdict_put(qdict, "family", get_sock_family(sa));
qdict_put(qdict, "family",qstring_from_str(inet_strfamily(sa->ss_family)));
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册