mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
miracle-wifid: remove duplicated link & peer dbus nodes by checking prefix
This commit is contained in:
parent
c5a4bf0457
commit
853152cb9c
1 changed files with 5 additions and 8 deletions
|
@ -830,12 +830,16 @@ static int manager_dbus_enumerate(sd_bus *bus,
|
||||||
char **nodes, *node;
|
char **nodes, *node;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
if(strcmp("/org/freedesktop/miracle/wifi", path)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
peer_cnt = 0;
|
peer_cnt = 0;
|
||||||
MANAGER_FOREACH_LINK(l, m)
|
MANAGER_FOREACH_LINK(l, m)
|
||||||
if (l->public)
|
if (l->public)
|
||||||
peer_cnt += l->peer_cnt;
|
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)
|
if (!nodes)
|
||||||
return log_ENOMEM();
|
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;
|
nodes[i] = NULL;
|
||||||
*out = nodes;
|
*out = nodes;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue