From 4a4d094d8e40b80e862a6c9271cd17ff486ce62b Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 23 Oct 2014 15:09:52 -0500 Subject: [PATCH] wiphy: Add device_get_path() utility --- src/wiphy.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/wiphy.c b/src/wiphy.c index 5dd8b21e..4e7dca81 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -71,6 +71,14 @@ static void do_debug(const char *str, void *user_data) l_info("%s%s", prefix, str); } +static const char *device_get_path(struct netdev *netdev) +{ + static char path[256]; + + snprintf(path, sizeof(path), "/%u", netdev->index); + return path; +} + static void device_emit_added(struct netdev *netdev) { @@ -137,12 +145,11 @@ static void bss_free(void *data) static void netdev_free(void *data) { struct netdev *netdev = data; - char path[256]; struct l_dbus *dbus; dbus = dbus_get_bus(); - snprintf(path, sizeof(path), "/%u", netdev->index); - l_dbus_unregister_interface(dbus, path, IWD_DEVICE_INTERFACE); + l_dbus_unregister_interface(dbus, device_get_path(netdev), + IWD_DEVICE_INTERFACE); device_emit_removed(netdev);