diff options
Diffstat (limited to 'src/network/networkd-network-bus.c')
-rw-r--r-- | src/network/networkd-network-bus.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/network/networkd-network-bus.c b/src/network/networkd-network-bus.c index e1e89e8357..0c4032633f 100644 --- a/src/network/networkd-network-bus.c +++ b/src/network/networkd-network-bus.c @@ -4,6 +4,7 @@ #include "ether-addr-util.h" #include "networkd-manager.h" #include "networkd-network-bus.h" +#include "path-util.h" #include "string-util.h" #include "strv.h" @@ -54,8 +55,8 @@ static const sd_bus_vtable network_vtable[] = { }; static char *network_bus_path(Network *network) { - _cleanup_free_ char *name = NULL; - char *networkname, *d, *path; + _cleanup_free_ char *name = NULL, *networkname= NULL; + char *d, *path; int r; assert(network); @@ -65,7 +66,9 @@ static char *network_bus_path(Network *network) { if (!name) return NULL; - networkname = basename(name); + r = path_extract_filename(name, &networkname); + if (r < 0) + return NULL; d = strrchr(networkname, '.'); if (!d) |