1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

network: use Network.name for bus path

No functional change, just refactoring.
This commit is contained in:
Yu Watanabe 2024-10-07 12:39:27 +09:00 committed by Daan De Meyer
parent a02166297c
commit 1faf2e5332

View File

@ -55,30 +55,13 @@ static const sd_bus_vtable network_vtable[] = {
};
static char *network_bus_path(Network *network) {
_cleanup_free_ char *name = NULL, *networkname= NULL;
char *d, *path;
char *path;
int r;
assert(network);
assert(network->filename);
assert(network->name);
name = strdup(network->filename);
if (!name)
return NULL;
r = path_extract_filename(name, &networkname);
if (r < 0)
return NULL;
d = strrchr(networkname, '.');
if (!d)
return NULL;
assert(streq(d, ".network"));
*d = '\0';
r = sd_bus_path_encode("/org/freedesktop/network1/network", networkname, &path);
r = sd_bus_path_encode("/org/freedesktop/network1/network", network->name, &path);
if (r < 0)
return NULL;