1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-13 11:41:51 +00:00

miracle-wifid: remove duplicated link & peer dbus nodes by checking prefix

This commit is contained in:
Derek Dai 2017-01-04 13:52:04 +08:00
parent c5a4bf0457
commit 853152cb9c
No known key found for this signature in database
GPG key ID: E109CC97553EF009

View file

@ -830,12 +830,16 @@ static int manager_dbus_enumerate(sd_bus *bus,
char **nodes, *node;
int r;
if(strcmp("/org/freedesktop/miracle/wifi", path)) {
return 0;
}
peer_cnt = 0;
MANAGER_FOREACH_LINK(l, m)
if (l->public)
peer_cnt += l->peer_cnt;
nodes = malloc(sizeof(*nodes) * (m->link_cnt + peer_cnt + 2));
nodes = malloc(sizeof(*nodes) * (m->link_cnt + peer_cnt + 1));
if (!nodes)
return log_ENOMEM();
@ -874,13 +878,6 @@ static int manager_dbus_enumerate(sd_bus *bus,
}
}
node = strdup("/org/freedesktop/miracle/wifi");
if (!node) {
r = log_ENOMEM();
goto error;
}
nodes[i++] = node;
nodes[i] = NULL;
*out = nodes;