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
1 changed files with 5 additions and 4 deletions

View File

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