mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-14 14:33:02 -04:00
modules: use pw_net_get_ip
Make pw_net_get_ip also accept NULL ip to just get the port and ip version. Make rtsp-client use pw_net_get_ip. Make sure we initialize the iovec before logging in all cases.
This commit is contained in:
parent
8860dc809d
commit
6d998a9193
3 changed files with 13 additions and 22 deletions
|
|
@ -152,13 +152,13 @@ static inline int pw_net_get_ip(const struct sockaddr_storage *sa, char *ip, siz
|
|||
|
||||
if (sa->ss_family == AF_INET) {
|
||||
struct sockaddr_in *in = (struct sockaddr_in*)sa;
|
||||
if (inet_ntop(sa->ss_family, &in->sin_addr, ip, len) == NULL)
|
||||
if (ip && inet_ntop(sa->ss_family, &in->sin_addr, ip, len) == NULL)
|
||||
return -errno;
|
||||
if (port)
|
||||
*port = ntohs(in->sin_port);
|
||||
} else if (sa->ss_family == AF_INET6) {
|
||||
struct sockaddr_in6 *in = (struct sockaddr_in6*)sa;
|
||||
if (inet_ntop(sa->ss_family, &in->sin6_addr, ip, len) == NULL)
|
||||
if (ip && inet_ntop(sa->ss_family, &in->sin6_addr, ip, len) == NULL)
|
||||
return -errno;
|
||||
if (port)
|
||||
*port = ntohs(in->sin6_port);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue