mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
storage: Refactor dirs creation logic to cleanup on failure
This commit is contained in:
parent
2acda158ef
commit
f92ce9441e
@ -200,16 +200,24 @@ bool storage_create_dirs(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
storage_path = l_strdup(state_dirs[0]);
|
storage_path = l_strdup(state_dirs[0]);
|
||||||
storage_hotspot_path = l_strdup_printf("%s/hotspot/", state_dirs[0]);
|
|
||||||
l_strv_free(state_dirs);
|
l_strv_free(state_dirs);
|
||||||
|
|
||||||
if (create_dirs(storage_path)) {
|
if (create_dirs(storage_path)) {
|
||||||
l_error("Failed to create %s", storage_path);
|
l_error("Failed to create %s", storage_path);
|
||||||
|
|
||||||
|
l_free(storage_path);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storage_hotspot_path = l_strdup_printf("%s/hotspot/", storage_path);
|
||||||
|
|
||||||
if (create_dirs(storage_hotspot_path)) {
|
if (create_dirs(storage_hotspot_path)) {
|
||||||
l_error("Failed to create %s", storage_hotspot_path);
|
l_error("Failed to create %s", storage_hotspot_path);
|
||||||
|
|
||||||
|
l_free(storage_path);
|
||||||
|
l_free(storage_hotspot_path);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user