3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

knownnetworks: Use storage_get_path to get storage directory

This commit is contained in:
Marcel Holtmann 2019-09-08 19:21:07 +02:00
parent 58d5fdf6c4
commit 49c4f46efc

View File

@ -822,6 +822,8 @@ static int known_networks_init(void)
DIR *dir; DIR *dir;
struct dirent *dirent; struct dirent *dirent;
L_AUTO_FREE_VAR(char *, storage_dir) = storage_get_path(NULL);
if (!l_dbus_register_interface(dbus, IWD_KNOWN_NETWORK_INTERFACE, if (!l_dbus_register_interface(dbus, IWD_KNOWN_NETWORK_INTERFACE,
setup_known_network_interface, setup_known_network_interface,
NULL, false)) { NULL, false)) {
@ -830,10 +832,9 @@ static int known_networks_init(void)
return -EPERM; return -EPERM;
} }
dir = opendir(DAEMON_STORAGEDIR); dir = opendir(storage_dir);
if (!dir) { if (!dir) {
l_info("Unable to open %s: %s", DAEMON_STORAGEDIR, l_info("Unable to open %s: %s", storage_dir, strerror(errno));
strerror(errno));
l_dbus_unregister_interface(dbus, IWD_KNOWN_NETWORK_INTERFACE); l_dbus_unregister_interface(dbus, IWD_KNOWN_NETWORK_INTERFACE);
return -ENOENT; return -ENOENT;
} }
@ -873,7 +874,7 @@ static int known_networks_init(void)
known_network_frequencies_load(); known_network_frequencies_load();
storage_dir_watch = l_dir_watch_new(DAEMON_STORAGEDIR, storage_dir_watch = l_dir_watch_new(storage_dir,
known_networks_watch_cb, NULL, known_networks_watch_cb, NULL,
known_networks_watch_destroy); known_networks_watch_destroy);
watchlist_init(&known_network_watches, NULL); watchlist_init(&known_network_watches, NULL);