mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
Use if_indextoname() instead of less portable ioctl(SIOCGIFNAME)
This commit is contained in:
parent
aafe815556
commit
44d92c21e5
1 changed files with 2 additions and 4 deletions
|
|
@ -619,7 +619,7 @@ static void resolver_cb(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiPr
|
|||
char hbuf[NI_MAXHOST];
|
||||
char if_suffix[16] = "";
|
||||
struct ifreq ifreq;
|
||||
int fd, res, family;
|
||||
int res, family;
|
||||
|
||||
if (event != AVAHI_RESOLVER_FOUND) {
|
||||
pw_log_error("Resolving of '%s' failed: %s", name,
|
||||
|
|
@ -672,9 +672,8 @@ static void resolver_cb(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiPr
|
|||
family = protocol == AVAHI_PROTO_INET ? AF_INET : AF_INET6;
|
||||
|
||||
spa_zero(ifreq);
|
||||
fd = socket(family, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
|
||||
ifreq.ifr_ifindex = interface;
|
||||
ioctl(fd, SIOCGIFNAME, &ifreq, sizeof(ifreq));
|
||||
if_indextoname(interface, ifreq.ifr_name);
|
||||
pw_properties_setf(props, "snapcast.ifname", "%s", ifreq.ifr_name);
|
||||
pw_properties_setf(props, "local.ifname", "%s", ifreq.ifr_name);
|
||||
|
||||
|
|
@ -709,7 +708,6 @@ static void resolver_cb(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiPr
|
|||
}
|
||||
}
|
||||
freeifaddrs(if_addr);
|
||||
close(fd);
|
||||
|
||||
for (l = txt; l; l = l->next) {
|
||||
char *key, *value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue