mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
main: Move storage directory creation into storage functionality
This commit is contained in:
parent
7e5ddb15d7
commit
45d5c67cb4
@ -451,15 +451,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
exit_status = EXIT_FAILURE;
|
exit_status = EXIT_FAILURE;
|
||||||
|
|
||||||
if (create_dirs(DAEMON_STORAGEDIR "/")) {
|
if (!storage_create_dirs())
|
||||||
l_error("Failed to create " DAEMON_STORAGEDIR "/");
|
|
||||||
goto fail_dbus;
|
goto fail_dbus;
|
||||||
}
|
|
||||||
|
|
||||||
if (create_dirs(DAEMON_STORAGEDIR "/hotspot/")) {
|
|
||||||
l_error("Failed to create " DAEMON_STORAGEDIR "/hotspot/");
|
|
||||||
goto fail_dbus;
|
|
||||||
}
|
|
||||||
|
|
||||||
genl = l_genl_new();
|
genl = l_genl_new();
|
||||||
if (!genl) {
|
if (!genl) {
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
#define STORAGE_DIR_MODE (S_IRUSR | S_IWUSR | S_IXUSR)
|
#define STORAGE_DIR_MODE (S_IRUSR | S_IWUSR | S_IXUSR)
|
||||||
#define STORAGE_FILE_MODE (S_IRUSR | S_IWUSR)
|
#define STORAGE_FILE_MODE (S_IRUSR | S_IWUSR)
|
||||||
|
|
||||||
int create_dirs(const char *filename)
|
static int create_dirs(const char *filename)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *dir;
|
char *dir;
|
||||||
@ -165,6 +165,21 @@ error_create_dirs:
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool storage_create_dirs(void)
|
||||||
|
{
|
||||||
|
if (create_dirs(DAEMON_STORAGEDIR "/")) {
|
||||||
|
l_error("Failed to create " DAEMON_STORAGEDIR "/");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (create_dirs(DAEMON_STORAGEDIR "/hotspot/")) {
|
||||||
|
l_error("Failed to create " DAEMON_STORAGEDIR "/hotspot/");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
char *storage_get_network_file_path(enum security type, const char *ssid)
|
char *storage_get_network_file_path(enum security type, const char *ssid)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
|
@ -25,14 +25,14 @@
|
|||||||
struct l_settings;
|
struct l_settings;
|
||||||
enum security;
|
enum security;
|
||||||
|
|
||||||
int create_dirs(const char *filename);
|
|
||||||
|
|
||||||
ssize_t read_file(void *buffer, size_t len, const char *path_fmt, ...)
|
ssize_t read_file(void *buffer, size_t len, const char *path_fmt, ...)
|
||||||
__attribute__((format(printf, 3, 4)));
|
__attribute__((format(printf, 3, 4)));
|
||||||
|
|
||||||
ssize_t write_file(const void *buffer, size_t len, const char *path_fmt, ...)
|
ssize_t write_file(const void *buffer, size_t len, const char *path_fmt, ...)
|
||||||
__attribute__((format(printf, 3, 4)));
|
__attribute__((format(printf, 3, 4)));
|
||||||
|
|
||||||
|
bool storage_create_dirs(void);
|
||||||
|
|
||||||
const char *storage_network_ssid_from_path(const char *path,
|
const char *storage_network_ssid_from_path(const char *path,
|
||||||
enum security *type);
|
enum security *type);
|
||||||
char *storage_get_network_file_path(enum security type, const char *ssid);
|
char *storage_get_network_file_path(enum security type, const char *ssid);
|
||||||
|
Loading…
Reference in New Issue
Block a user