diff options
author | OMOJOLA JOSHUA DAMILOLA <omojolajoshua@gmail.com> | 2023-04-01 20:52:32 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-04-04 01:10:22 +0200 |
commit | de2820606d872ddc9c82cc138a5bdfc302863a2d (patch) | |
tree | ac8af3e7c9a69ccc31db668ca7fd92b185303f1d /src/network/networkd-network-bus.c | |
parent | Merge pull request #27114 from keszybz/trivial-cleanups (diff) | |
download | systemd-de2820606d872ddc9c82cc138a5bdfc302863a2d.tar.xz systemd-de2820606d872ddc9c82cc138a5bdfc302863a2d.zip |
src: changed usage of basename() to path_extract_filename().
TODO.
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) |