summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-network-bus.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-10-07 05:39:27 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-10-07 09:48:57 +0200
commit1faf2e5332633901dc52fb4baf07953f33b6a079 (patch)
tree2ce210a8fa3e8c702baaa05f9d71ae08874b78ae /src/network/networkd-network-bus.c
parentnetworkctl: sort ifindexes in status command (diff)
downloadsystemd-1faf2e5332633901dc52fb4baf07953f33b6a079.tar.xz
systemd-1faf2e5332633901dc52fb4baf07953f33b6a079.zip
network: use Network.name for bus path
No functional change, just refactoring.
Diffstat (limited to '')
-rw-r--r--src/network/networkd-network-bus.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/src/network/networkd-network-bus.c b/src/network/networkd-network-bus.c
index 0c4032633f..5c61cbf887 100644
--- a/src/network/networkd-network-bus.c
+++ b/src/network/networkd-network-bus.c
@@ -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;