mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 23:09:34 +01:00
storage: Simplify storage_network_open
This commit is contained in:
parent
180a893c0c
commit
38952813dd
@ -253,31 +253,20 @@ const char *storage_network_ssid_from_path(const char *path,
|
|||||||
struct l_settings *storage_network_open(const char *type, const char *ssid)
|
struct l_settings *storage_network_open(const char *type, const char *ssid)
|
||||||
{
|
{
|
||||||
struct l_settings *settings;
|
struct l_settings *settings;
|
||||||
struct stat st;
|
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
if (ssid == NULL || type == NULL)
|
if (ssid == NULL || type == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
path = get_network_file_path(type, ssid);
|
path = get_network_file_path(type, ssid);
|
||||||
|
|
||||||
if (lstat(path, &st) < 0) {
|
|
||||||
l_free(path);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
settings = l_settings_new();
|
settings = l_settings_new();
|
||||||
|
|
||||||
if (!l_settings_load_from_file(settings, path)) {
|
if (!l_settings_load_from_file(settings, path)) {
|
||||||
l_free(path);
|
|
||||||
l_settings_free(settings);
|
l_settings_free(settings);
|
||||||
|
settings = NULL;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
l_free(path);
|
l_free(path);
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user